Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Random crashes on TableView delete event

I'm running into random crashes whenever I delete a row from a tableView.

The tableView consists of 2 sections and is being used to hold a form.

-Section: General
---Textfield
---Textfield

-Section: List
---Textfield - Button
[---TableViewRow]*
  • =a generated list of items, all exact the same like this one using the following function:
    function createRowFromData(current){
      var nextItemRow = Titanium.UI.createTableViewRow({title: current.name});
      nextItemRow.touchEnabled=true;
      nextItemRow.hasCheck = current.checked;    
      return nextItemRow;
    }
    
    The user is allowed to click (in order to (un)check the rows), or swipe-to-delete the rows. (un)checking works without a problem.
    Deleting crashes the app 3 times out of 10.

I can't figure out what this is related to at all.
iPhone simulator just quits the app, and this is all I'm left with:

[DEBUG] Session did end with error (null)
[INFO] Application has exited from Simulator

I tried to see if it's related to my delete handler (which reflects the deleted row action to an array that holds the data of the table) using an info() trace but I never get to see it, so I presume the app crashes before it even gets to that statement.

At one point I decided to see if the delete handler was in any way involved in this, so I just commented it out. With enough patience I got the app to quit again, this time providing a stack trace.

[ERROR] The application has crashed with an unhandled exception. Stack trace:
0 CoreFoundation 0x03846b7c __exceptionPreprocess + 156
1 libobjc.A.dylib 0x0399640e objc_exception_throw + 47
2 CoreFoundation 0x0383c695 -[__NSArrayM objectAtIndex:] + 261
3 GroceryList 0x000245df -[TiUITableViewSectionProxy rowAtIndex:] + 60
4 GroceryList 0x0007c802 -[TiUITableView rowForIndexPath:] + 121
5 GroceryList 0x000822a4 -[TiUITableView tableView:canEditRowAtIndexPath:] + 77
6 UIKit 0x008dacc1 -[UITableView(_UITableViewPrivate) _canEditRowAtIndexPath:] + 83
7 UIKit 0x008e15fa -[UITableView(UITableViewInternal) _setupCell:forEditing:atIndexPath:animated:] + 125
8 UIKit 0x008ea3cd -[UITableView setEditing:animated:] + 436
9 UIKit 0x008d6b42 -[UITableView(UITableViewInternal) _endSwipeToDeleteRowDidDelete:] + 158
10 UIKit 0x0086f7f8 -[UIApplication sendAction:to:from:forEvent:] + 119
11 UIKit 0x008fade0 -[UIControl sendAction:to:forEvent:] + 67
12 UIKit 0x008fd262 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
13 UIKit 0x008fbe0f -[UIControl touchesEnded:withEvent:] + 458
14 UIKit 0x008933d0 -[UIWindow _sendTouchesForEvent:] + 567
15 UIKit 0x00874cb4 -[UIApplication sendEvent:] + 447
16 UIKit 0x008799bf _UIApplicationHandleEvent + 7672
17 GraphicsServices 0x0542e822 PurpleEventCallback + 1550
18 CoreFoundation 0x03827ff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
19 CoreFoundation 0x03788807 __CFRunLoopDoSource1 + 215
20 CoreFoundation 0x03785a93 __CFRunLoopRun + 979
21 CoreFoundation 0x03785350 CFRunLoopRunSpecific + 208
22 CoreFoundation 0x03785271 CFRunLoopRunInMode + 97
23 GraphicsServices 0x0542d00c GSEventRunModal + 217
24 GraphicsServices 0x0542d0d1 GSEventRun + 115
25 UIKit 0x0087daf2 UIApplicationMain + 1160
26 GroceryList 0x00004449 main + 362
27 GroceryList 0x00003231 start + 53
2010-11-22 09:24:06.051 GroceryList[90242:40b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 3 beyond bounds [0 .. 2]'
*** Call stack at first throw:
(
0 CoreFoundation 0x03846b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0399640e objc_exception_throw + 47
2 CoreFoundation 0x0383c695 -[__NSArrayM objectAtIndex:] + 261
3 GroceryList 0x000245df -[TiUITableViewSectionProxy rowAtIndex:] + 60
4 GroceryList 0x0007c802 -[TiUITableView rowForIndexPath:] + 121
5 GroceryList 0x000822a4 -[TiUITableView tableView:canEditRowAtIndexPath:] + 77
6 UIKit 0x008dacc1 -[UITableView(_UITableViewPrivate) _canEditRowAtIndexPath:] + 83
7 UIKit 0x008e15fa -[UITableView(UITableViewInternal) _setupCell:forEditing:atIndexPath:animated:] + 125
8 UIKit 0x008ea3cd -[UITableView setEditing:animated:] + 436
9 UIKit 0x008d6b42 -[UITableView(UITableViewInternal) _endSwipeToDeleteRowDidDelete:] + 158
10 UIKit 0x0086f7f8 -[UIApplication sendAction:to:from:forEvent:] + 119
11 UIKit 0x008fade0 -[UIControl sendAction:to:forEvent:] + 67
12 UIKit 0x008fd262 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
13 UIKit 0x008fbe0f -[UIControl touchesEnded:withEvent:] + 458
14 UIKit 0x008933d0 -[UIWindow _sendTouchesForEvent:] + 567
15 UIKit 0x00874cb4 -[UIApplication sendEvent:] + 447
16 UIKit 0x008799bf _UIApplicationHandleEvent + 7672
17 GraphicsServices 0x0542e822 PurpleEventCallback + 1550
18 CoreFoundation 0x03827ff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
19 CoreFoundation 0x03788807 __CFRunLoopDoSource1 + 215
20 CoreFoundation 0x03785a93 __CFRunLoopRun + 979
21 CoreFoundation 0x03785350 CFRunLoopRunSpecific + 208
22 CoreFoundation 0x03785271 CFRunLoopRunInMode + 97
23 GraphicsServices 0x0542d00c GSEventRunModal + 217
24 GraphicsServices 0x0542d0d1 GSEventRun + 115
25 UIKit 0x0087daf2 UIApplicationMain + 1160
26 GroceryList 0x00004449 main + 362
27 GroceryList 0x00003231 start + 53
)
terminate called after throwing an instance of 'NSException'

At this point I have no clue what is happening, or what to look for.
Is there anybody who knows what I'm doing wrong, or what this migh be related to?
Any help would be highly appreciated.

— asked November 22nd 2010 by Ronny Welter
  • crash
  • delete
  • iphone
  • simulator
  • tableview
0 Comments

4 Answers

  • Did you figure this out? I'm running into the same thing, but I crash consistently on a tableview row delete.

    — answered February 10th 2011 by Pete Clark
    permalink
    0 Comments
  • I started having the same problem but only on Android. The iPhone version deletes properly. Have you found any solution?

    — answered February 28th 2011 by Abraham Vivas
    permalink
    0 Comments
  • I have the same problem but found that the app only crashes when I delete the first row in the table.

    Does anyone have any solutions for this?

    — answered December 24th 2011 by Dan Orange
    permalink
    0 Comments
  • I had a "similar" situation. My app would crash when I closed a window I had created with createWindow(..) if I had added a tableView with rows to the window. I fixed the issue by simply calling win.remove(myTableView).. Titanium has COUNTLESS issues on android, I have spent the last 2 weeks porting an IOS app I wrote with titanium to android..

    — answered January 2nd 2012 by Dave Patton
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.