Hero: Crash during transition

Created on 3 Apr 2017  路  14Comments  路  Source: HeroTransitions/Hero

Hi,

I'm having the following crash, sometimes in a transition:

Crashed: com.apple.main-thread
0 Hero 0x102bc6940 HeroContext.snapshotView(for : UIView) -> UIView (HeroContext.swift:182)
1 Hero 0x102bfdbbc HeroDefaultAnimator.animate(view : UIView, appearing : Bool) -> () (HeroDefaultAnimator.swift:107)
2 Hero 0x102bfcea0 HeroDefaultAnimator.animate(fromViews : [UIView], toViews : [UIView]) -> Double (HeroDefaultAnimator.swift)
3 Hero 0x102bfe670 protocol witness for HeroAnimator.animate(fromViews : [UIView], toViews : [UIView]) -> Double in conformance (HeroDefaultAnimator.swift)
4 Hero 0x102bbedc0 HeroBaseController.animate() -> () (HeroBaseController.swift:307)
5 Hero 0x102bbef80 @objc HeroBaseController.animate() -> () (HeroBaseController.swift)
6 Hero 0x102bb30fc Hero.animate() -> () (Hero.swift:202)
7 Hero 0x102bb34cc @objc Hero.animate() -> () (Hero.swift)
8 Hero 0x102bb2b54 Hero.start() -> () (Hero.swift:189)
9 Hero 0x102bb2cfc @objc Hero.start() -> () (Hero.swift)
10 Hero 0x102bb6078 @objc Hero.animateTransition(using : UIViewControllerContextTransitioning) -> () (Hero.swift)
11 UIKit 0x18d10d30c __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 2128
12 UIKit 0x18d04ffdc _runAfterCACommitDeferredBlocks + 292
13 UIKit 0x18d041d50 _cleanUpAfterCAFlushAndRunDeferredBlocks + 560
14 UIKit 0x18cdb10b4 _afterCACommitHandler + 168
15 CoreFoundation 0x186eb60c0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
16 CoreFoundation 0x186eb3cf0 __CFRunLoopDoObservers + 372
17 CoreFoundation 0x186eb4180 __CFRunLoopRun + 1024
18 CoreFoundation 0x186de22b8 CFRunLoopRunSpecific + 444
19 GraphicsServices 0x188896198 GSEventRunModal + 180
20 UIKit 0x18ce297fc -[UIApplication _run] + 684
21 UIKit 0x18ce24534 UIApplicationMain + 208
22 Grability 0x1003edb24 main (main.m:17)
23 libdispatch.dylib 0x185dc55b8 (Missing)

All 14 comments

I have the same issue and also a strange Crash on

https://github.com/lkzhao/Hero/blob/master/Sources/Hero.swift#L141

I'm using Crashlytics and I got a popular crash on UIView+Hero.swift
specifically because of this force unwrap:
var snapshot = snapshotView(afterScreenUpdates: true)!
That is the same crash @hmvr414 talks about

I've got a similar crash using Hero 0.3.6:

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   Hero                            0x005b6f3c Hero.start() -> () (Hero.swift:140)
1   Hero                            0x005b6498 Hero.start() -> () (Hero.swift:140)
2   Hero                            0x005b6f68 @objc Hero.start() -> () (Hero.swift:0)
3   Hero                            0x005b97e8 @objc Hero.animateTransition(using : UIViewControllerContextTransitioning) -> () (Hero.swift:0)
4   UIKit                           0x223dedd0 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 2864
5   UIKit                           0x22324dc2 _runAfterCACommitDeferredBlocks + 276
6   UIKit                           0x223180d2 _cleanUpAfterCAFlushAndRunDeferredBlocks + 524
7   UIKit                           0x22099cfc _afterCACommitHandler + 112
8   CoreFoundation                  0x1ce33802 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
9   CoreFoundation                  0x1ce31a54 __CFRunLoopDoObservers + 282
10  CoreFoundation                  0x1ce32016 __CFRunLoopRun + 1358
11  CoreFoundation                  0x1cd850ee CFRunLoopRunSpecific + 470
12  CoreFoundation                  0x1cd84f10 CFRunLoopRunInMode + 104
13  GraphicsServices                0x1e52fb40 GSEventRunModal + 80
14  UIKit                           0x22109e82 UIApplicationMain + 150

Here's another report of (probably) the same bug.
Due to unknown problem, I couldn't fully symbolicate it, though.

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   Hero                            0x00757e8c 0x727000 + 200332
1   Hero                            0x00757494 0x727000 + 197780
2   Hero                            0x0075a840 0x727000 + 211008
3   UIKit                           0x223dedd0 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 2864
4   UIKit                           0x22324dc2 _runAfterCACommitDeferredBlocks + 276
5   UIKit                           0x223180d2 _cleanUpAfterCAFlushAndRunDeferredBlocks + 524
6   UIKit                           0x22099cfc _afterCACommitHandler + 112
7   CoreFoundation                  0x1ce33802 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
8   CoreFoundation                  0x1ce31a54 __CFRunLoopDoObservers + 282
9   CoreFoundation                  0x1ce32016 __CFRunLoopRun + 1358
10  CoreFoundation                  0x1cd850ee CFRunLoopRunSpecific + 470
11  CoreFoundation                  0x1cd84f10 CFRunLoopRunInMode + 104
12  GraphicsServices                0x1e52fb40 GSEventRunModal + 80
13  UIKit                           0x22109e82 UIApplicationMain + 150
14  MineRimoto                      0x000e2b50 0xdd000 + 23376
15  libdyld.dylib                   0x1c5724ea start + 2

Same crash happening here:

Thread 0 name: 
Thread 0 Crashed:
0   Hero                            0x1009f61d4         Hero.start() -> () (Hero.swift:140)
1   Hero                            0x1009f6204         @objc Hero.start() -> ()
2   Hero                            0x1009f8390         [inlined] Hero.animateTransition(using : UIViewControllerContextTransitioning) -> ()
3   Hero                            0x1009f8390         @objc Hero.animateTransition(using : UIViewControllerContextTransitioning) -> ()
4   UIKit                           0x319abc30c         __56-[UIPresentationController runTransitionForCurrentState]_block_invoke
5   UIKit                           0x3199fefdc         _runAfterCACommitDeferredBlocks
6   UIKit                           0x3199f0d50         _cleanUpAfterCAFlushAndRunDeferredBlocks
7   UIKit                           0x3197600b4         _afterCACommitHandler
8   CoreFoundation                  0x30d88f0c0         __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
9   CoreFoundation                  0x30d88ccf0         __CFRunLoopDoObservers
10  CoreFoundation                  0x30d88d180         __CFRunLoopRun
11  CoreFoundation                  0x30d7bb2b8         CFRunLoopRunSpecific
12  GraphicsServices                0x310d20198         GSEventRunModal
13  UIKit                           0x3197d87fc         -[UIApplication _run]
14  UIKit                           0x3197d3534         UIApplicationMain

Any news about it ?

anything that solved this crash ?

@lkzhao Why is this closed? It needs to be re-opened.

rashed: com.apple.main-thread 0 Hero 0x1011d74d8 specialized HeroContext.snapshotView(for:) (HeroContext.swift:212) 1 Hero 0x10122a994 HeroTransition.animate() (HeroTransition+Animate.swift:50) 2 Hero 0x101225790 partial apply for closure #6 in HeroTransition.start() (HeroTransition+Start.swift:157) 3 Hero 0x101224cc4 thunk for @callee_owned () -> () (HeroTransition+Start.swift) 4 libdispatch.dylib 0x182356a54 _dispatch_call_block_and_release + 24 5 libdispatch.dylib 0x182356a14 _dispatch_client_callout + 16 6 libdispatch.dylib 0x182363698 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1016 7 CoreFoundation 0x18297f344 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 8 CoreFoundation 0x18297cf20 __CFRunLoopRun + 2012 9 CoreFoundation 0x18289cc58 CFRunLoopRunSpecific + 436 10 GraphicsServices 0x184748f84 GSEventRunModal + 100

@kylebrowning Can you checkout the master version and see if it is still crashing for you. We dont use force unwrap when calling snapshotView(for:) anymore and it shouldn't crash.

@lkzhao Thank you for the quick response.

I just took a look at the master branch.

It's still being force unwrapped.

https://github.com/lkzhao/Hero/blob/master/Sources/HeroContext.swift#L212

Same here

screenshot 2019-02-13 at 19 27 50

Did anyone solve this?

I'm a bit too busy to make and test a fix,
could someone in this thread please submit a PR with tests as a plus for quick review/merge.

I have this ear marked for 1.7.0.

Was this page helpful?
0 / 5 - 0 ratings