Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes when deleting an item in second last row #34

Closed
stevenchan opened this issue Jan 23, 2011 · 1 comment
Closed

Crashes when deleting an item in second last row #34

stevenchan opened this issue Jan 23, 2011 · 1 comment

Comments

@stevenchan
Copy link
Contributor

App crashes when deleting items in second last row

This happens when

  • Content height is greater than grid view frame height
  • Scrolled to the bottom
  • Last row has only ONE item

It seems like the problem is in this line which adds NSNotFound to animatingDestinationIndices (AQGridView.m:1631, 5995654c1ed39a81a09e):
for ( AQGridViewAnimatorItem * item in _animatingCells )
{
[animatingDestinationIndices addIndex: item.index];
}

I got this from the debugger console:
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSMutableIndexSet addIndexesInRange:]: Range {2147483647, 1} exceeds maximum index value of NSNotFound - 1'
*** Call stack at first throw:
(
0 CoreFoundation 0x3587a987 exceptionPreprocess + 114
1 libobjc.A.dylib 0x34a8249d objc_exception_throw + 24
2 CoreFoundation 0x3587a7c9 +[NSException raise:format:arguments:] + 68
3 CoreFoundation 0x3587a803 +[NSException raise:format:] + 34
4 Foundation 0x3118d10d -[NSMutableIndexSet addIndexesInRange:] + 96
5 Foundation 0x3118d0a7 -[NSMutableIndexSet addIndex:] + 18
6 50k 0x0003589f -[AQGridView(AQCellLayout) updateVisibleGridCellsNow] + 3386
7 50k 0x000310bb -[AQGridView layoutSubviews] + 202
8 UIKit 0x341b80cf -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 26
9 CoreFoundation 0x35818bbf -[NSObject(NSObject) performSelector:withObject:] + 22
10 QuartzCore 0x31075685 -[CALayer layoutSublayers] + 120
11 QuartzCore 0x3107543d CALayerLayoutIfNeeded + 184
12 QuartzCore 0x3106f56d _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 212
13 QuartzCore 0x3106f383 _ZN2CA11Transaction6commitEv + 190
14 QuartzCore 0x31092f9d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 52
15 CoreFoundation 0x3580ac59 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION
+ 16
16 CoreFoundation 0x3580aacd __CFRunLoopDoObservers + 412
17 CoreFoundation 0x358020cb __CFRunLoopRun + 854
18 CoreFoundation 0x35801c87 CFRunLoopRunSpecific + 230
19 CoreFoundation 0x35801b8f CFRunLoopRunInMode + 58
20 GraphicsServices 0x320c84ab GSEventRunModal + 114
21 GraphicsServices 0x320c8557 GSEventRun + 62
22 UIKit 0x341dc329 -[UIApplication _run] + 412
23 UIKit 0x341d9e93 UIApplicationMain + 670
24 50k 0x00002e2b main + 70
25 50k 0x00002de0 start + 40
)
terminate called after throwing an instance of 'NSException'

@stevenchan
Copy link
Contributor Author

I fixed it myself (stevenchan/AQGridView@45bf836b6170cbd53227) by adding a catch block to catch the exception and everything seems fine. Thanks for the great code!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant