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

Animation Timers after delegate deallocated #33

Closed
walsh2000 opened this issue Nov 7, 2014 · 4 comments
Closed

Animation Timers after delegate deallocated #33

walsh2000 opened this issue Nov 7, 2014 · 4 comments

Comments

@walsh2000
Copy link

I encountered a crash yesterday which I suspect to be the cell's animation timer firing after the cell's delegate has been deallocated.

The interesting part of the crash log indicates that the cell was trying to see if his delegate responds to
@selector(swipeTableCell:didChangeSwipeState:gestureIsActive:)
-[MGSwipeTableCell updateState:] (MGSwipeTableCell.m:674)

Is there a well-known pattern for invalidating all cell timers when the VC will/did disappear?
Should I be clearing every cell's delegate when the view will disappear, or is there some other preferred solution?

Thank you for any suggestions.
I am using version 1.2.0 (pod update isn't catching 1.3.0 yet)


Thread : Crashed: com.apple.main-thread
0 libsystem_platform.dylib 0x0000000195e1d2c0 platform_memmove + 112
1 libobjc.A.dylib 0x0000000195603258 memdup_internal + 52
2 libobjc.A.dylib 0x0000000195603258 memdup_internal + 52
3 libobjc.A.dylib 0x0000000195610778 fixupMethodList(method_list_t
, bool, bool) + 64
4 libobjc.A.dylib 0x0000000195610600 attachMethodLists(objc_class
, method_list_t*
, int, bool, bool, bool) + 316
5 libobjc.A.dylib 0x0000000195608664 realizeClass(objc_class_) + 1448
6 libobjc.A.dylib 0x000000019560c930 lookUpImpOrForward + 224
7 libobjc.A.dylib 0x0000000195617db8 _objc_msgSend_uncached_impcache + 56
8 TestApp 0x00000001001d618c -MGSwipeTableCell updateState:
9 TestApp 0x00000001001d62d8 -MGSwipeTableCell setSwipeOffset:
10 TestApp 0x00000001001d6958 -MGSwipeTableCell animationTick:
11 QuartzCore 0x0000000189065280 CA::Display::DisplayLinkItem::dispatch() + 32
12 QuartzCore 0x0000000189065118 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 324
13 IOKit 0x000000018605d8d0 IODispatchCalloutFromCFMessage + 376
14 CoreFoundation 0x0000000184eb4ce0 __CFMachPortPerform + 180
15 CoreFoundation 0x0000000184ec98fc CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 56
16 CoreFoundation 0x0000000184ec985c __CFRunLoopDoSource1 + 436
17 CoreFoundation 0x0000000184ec77dc __CFRunLoopRun + 1640
18 CoreFoundation 0x0000000184df51f4 CFRunLoopRunSpecific + 396
19 GraphicsServices 0x000000018df8b5a4 GSEventRunModal + 168
20 UIKit 0x0000000189726784 UIApplicationMain + 1488
21 TestApp 0x000000010010e688 main (main.m:16)
22 libdyld.dylib 0x0000000195c72a08 start + 4

@walsh2000
Copy link
Author

I can reproduce this 100% of the time if i do the following:

  1. Set the animation duration to 5s (not true in my case, but it makes it easier to report)
  2. Left (or right) swipe so buttons show
  3. tap on the cell to close
  4. While the cell is animating back over the buttons, navigate away from the VC which hosts the table
    -- assuming this deallocates the table's VC

@walsh2000
Copy link
Author

I found a resolution & submitted a pull request.

@MortimerGoro
Copy link
Owner

Thank you for your pull request ;)

@walsh2000
Copy link
Author

Happy to help. Thank you for open-sourcing your code.

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

2 participants