Skip to content

Crash when scrolling to the top #11

@Ricardo1980

Description

@Ricardo1980

Sometimes, when I scroll the table (more than necessary) to see the header, the app stops for 60 seconds, and then after that it crashes giving this message. Probably it is a buffer overflow but I don't know where exactly.
Note that this happens when I scroll the table in a way that the index bar is resized to a very small size, I would say this is related.
I relayout the index bar when scrolling, because I want it below the headerview.
Currently I am using version 0.3.5

A workaround is to limit scrolling, like this:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    [self.indexView setNeedsLayout];

    // to avoid a weird crash
    if (scrollView.contentOffset.y < kTableViewScrollLimit) {
        scrollView.contentOffset = CGPointMake(0.0f, kTableViewScrollLimit);
    }
}
2016-01-29 10:57:08.858 BLABLA[87354:2740121] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM setObject:atIndex:]: index 18446744071562067968 beyond bounds [0 .. 2147483647]'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000112edee65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000112957deb objc_exception_throw + 48
    2   CoreFoundation                      0x0000000112e32454 -[__NSArrayM setObject:atIndex:] + 452
    3   GDIIndexBar                         0x000000010fbf0338 -[GDIIndexBar updateDisplayedIndexStrings] + 904
    4   GDIIndexBar                         0x000000010fbf1a69 -[GDIIndexBar drawRect:] + 121
    5   UIKit                               0x000000011098ff08 -[UIView(CALayerDelegate) drawLayer:inContext:] + 495
    6   QuartzCore                          0x000000011047b183 -[CALayer drawInContext:] + 257
    7   QuartzCore                          0x000000011037033d CABackingStoreUpdate_ + 2688
    8   QuartzCore                          0x000000011047b002 ___ZN2CA5Layer8display_Ev_block_invoke + 59
    9   QuartzCore                          0x000000011047ae80 _ZN2CA5Layer8display_Ev + 1460
    10  QuartzCore                          0x000000011046fc69 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 293
    11  QuartzCore                          0x000000011046fcf9 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 35
    12  QuartzCore                          0x0000000110464475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
    13  QuartzCore                          0x0000000110491c0a _ZN2CA11Transaction6commitEv + 486
    14  QuartzCore                          0x00000001104a09f4 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 576
    15  CoreFoundation                      0x0000000112e3ec84 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
    16  CoreFoundation                      0x0000000112e3e831 __CFRunLoopDoTimer + 1089
    17  CoreFoundation                      0x0000000112e00241 __CFRunLoopRun + 1937
    18  CoreFoundation                      0x0000000112dff828 CFRunLoopRunSpecific + 488
    19  GraphicsServices                    0x0000000115bcead2 GSEventRunModal + 161
    20  UIKit                               0x00000001108d9610 UIApplicationMain + 171
    21  WorkAngel                           0x000000010d5611a3 main + 147
    22  libdyld.dylib                       0x000000011388e92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions