views:

224

answers:

1

I periodically am reproing a crash on a debug build running on my iPhone involving a UIScrollView with none of my code in the stack frame. I would like to know if it's a bug in my code or Apple's, and I am unable to query the Apple bug database to see if it has been reported. The backtrace shows:

#0  0x30218060 in ___forwarding___ ()
#1  0x3020eda0 in __forwarding_prep_0___ ()
#2  0x309c4ce8 in -[UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded] ()
#3  0x3025af60 in -[NSObject performSelector:withObject:] ()
#4  0x3098ea94 in -[UIAnimator stopAnimation:] ()
#5  0x3098e5a8 in -[UIAnimator(Static) _advance:] ()
#6  0x3098e460 in LCDHeartbeatCallback ()
#7  0x32047fe8 in HeartbeatVBLCallback ()
#8  0x32a1c3ec in IOMobileFramebufferNotifyFunc ()
#9  0x3188a74c in IODispatchCalloutFromCFMessage ()
#10 0x3020d0b0 in __CFMachPortPerform ()
#11 0x30254a76 in CFRunLoopRunSpecific ()
#12 0x3025416a in CFRunLoopRunInMode ()
#13 0x320452a4 in GSEventRunModal ()
#14 0x308f037c in -[UIApplication _run] ()
#15 0x308eea94 in UIApplicationMain ()
#16 0x0000280c in main (argc=1, argv=0x2ffff58c) at /Users/esilver/Documents/Husband Material/main.m:14

The problem is apparently in UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded. GDB reports:

-[MyViewController respondsToSelector:]: message sent to deallocated instance 0x5d77ad0

In MyViewController, I do have a call to scroll a tableView:

[self.tableView scrollToRowAtIndexPath:scrollIndexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];  

Because it's animated, it's clearly possible that the view could get popped off the navigation controller before the scrolling animation completes. It seems like it should be the job of the UIView to cancel or wait for any pending scrolling operations when it is unloading. Therefore, I think this is a bug in Apple's code.

Or am I mistaken, and is there some kind of checking my view must do check if it's scrolling prior to unloading, or am I misreading this crash entirely?

FYI, this bug also only appears to repro in low-memory conditions, i.e. I have started receiving didReceiveMemoryWarning callbacks.

Thanks all,

Eric

A: 

I just found this thread on StackOverflow here:

http://stackoverflow.com/questions/1898626/is-there-a-way-to-cancel-an-animated-uitableview-uiscrollview-setcontentoffsetan

I think this answers my own question. Nevermind...

esilver