Problem description
Trying to reorder the rows of a TableView by dragging the rows up and down, the app sometimes crashes.
Steps to reproduce
Using the following method crashes the app always:
1. create the followint app:
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
var data = [ {title: 'Apples'}, {title: 'Bananas'}, {title: 'Carrots'}, {title: 'Potatoes'}];
var table = Ti.UI.createTableView({
data: data,
moving: true
});
win.add(table);
win.open();
2. Start dragging one of the rows
3. While holding the row, rotate the device
Current result
The app crashes and the followint error is shown in console:
[ERROR] The application has crashed with an unhandled exception. Stack trace:
0 CoreFoundation 0x02f6e022 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x02d8ecd6 objc_exception_throw + 44
2 CoreFoundation 0x02f5ad88 -[__NSArrayM objectAtIndex:] + 264
3 UIKit 0x00b60250 -[UITableView cellForRowAtIndexPath:] + 219
4 UIKit 0x00b6d2b4 -[UITableView(UITableViewInternal) _reorderPositionChangedForCell:withScrollFactorPercentage:] + 2687
5 UIKit 0x00b6c830 -[UITableView(UITableViewInternal) _reorderPositionChangedForCell:] + 48
6 UIKit 0x00b69243 -[UITableView(UITableViewInternal) _beginReorderingForCell:] + 1043
7 UIKit 0x00cc39ed -[UITableViewCell(UITableViewCellInternal) _grabberBeganReorder:] + 57
8 UIKit 0x00d6b025 -[UITableViewCellReorderControl beginTrackingWithTouch:withEvent:] + 99
9 UIKit 0x00b79cee -[UIControl touchesBegan:withEvent:] + 108
10 UIKit 0x00d95a1a _UIGestureRecognizerUpdate + 6725
11 CoreFoundation 0x02f4299e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
12 CoreFoundation 0x02ed9640 __CFRunLoopDoObservers + 384
13 CoreFoundation 0x02ea54c6 __CFRunLoopRun + 1174
14 CoreFoundation 0x02ea4d84 CFRunLoopRunSpecific + 212
15 CoreFoundation 0x02ea4c9b CFRunLoopRunInMode + 123
16 GraphicsServices 0x02bcc7d8 GSEventRunModal + 190
17 GraphicsServices 0x02bcc88a GSEventRun + 103
18 UIKit 0x00ad1626 UIApplicationMain + 1163
19 TestApp 0x00005cb8 main + 456
20 TestApp 0x00002625 start + 53
2012-07-23 15:24:07.618 TestApp[4683:17603] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 4 beyond bounds [0 .. 3]'
*** First throw call stack:
(0x2f6e022 0x2d8ecd6 0x2f5ad88 0xb60250 0xb6d2b4 0xb6c830 0xb69243 0xcc39ed 0xd6b025 0xb79cee 0xd95a1a 0x2f4299e 0x2ed9640 0x2ea54c6 0x2ea4d84 0x2ea4c9b 0x2bcc7d8 0x2bcc88a 0xad1626 0x5cb8 0x2625)
terminate called throwing an exception
Confirmed the bug with 2.1.1.GA And 2.2.0.v20120730212111
Issue does not reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 iOS iPhone Simulator: iOS SDK version: 6.0
Closing ticket as the issue cannot be reproduced.