HeroTransitions / Hero

Elegant transition library for iOS & tvOS
https://HeroTransitions.github.io/Hero/
MIT License
22.06k stars 1.73k forks source link

Crash on Hero.HeroTransition.start() -> () HeroTransition+Start.swift, line 121 #734

Open sadeghgoo opened 2 years ago

sadeghgoo commented 2 years ago
Spy
0x100d10000 + 150232
Spy
0x100d10000 + 150264
UIKitCore
-[UIView(CALayerDelegate) layoutSublayersOfLayer:]
QuartzCore
CA::Layer::layout_if_needed(CA::Transaction*)
UIKitCore
-[UIView(Hierarchy) layoutBelowIfNeeded]
Hero
Hero.HeroTransition.start() -> () HeroTransition+Start.swift:121
Hero
Hero.HeroTransition.animateTransition(using: __C.UIViewControllerContextTransitioning) -> () HeroTransition+UIViewControllerTransitioningDelegate.swift:64
Hero
@objc Hero.HeroTransition.animateTransition(using: __C.UIViewControllerContextTransitioning) -> () <compiler-generated>:0
UIKitCore
___UIViewControllerTransitioningRunCustomTransition_block_invoke_2
UIKitCore
+[UIKeyboardSceneDelegate _pinInputViewsForKeyboardSceneDelegate:onBehalfOfResponder:duringBlock:]
UIKitCore
___UIViewControllerTransitioningRunCustomTransition_block_invoke.663
UIKitCore
+[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:]
UIKitCore
_UIViewControllerTransitioningRunCustomTransition
UIKitCore
-[UINavigationController _startCustomTransition:]
UIKitCore
-[UINavigationController _startDeferredTransitionIfNeeded:]
UIKitCore
-[UINavigationController __viewWillLayoutSubviews]
UIKitCore
-[UILayoutContainerView layoutSubviews]
UIKitCore
-[UIView(CALayerDelegate) layoutSublayersOfLayer:]
QuartzCore
CA::Layer::layout_if_needed(CA::Transaction*)
QuartzCore
CA::Layer::layout_and_display_if_needed(CA::Transaction*)
QuartzCore
CA::Context::commit_transaction(CA::Transaction*, double, double*)
QuartzCore
CA::Transaction::commit()
QuartzCore
CA::Transaction::flush_as_runloop_observer(bool)
CoreFoundation
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
CoreFoundation
__CFRunLoopDoObservers
CoreFoundation
__CFRunLoopRun
CoreFoundation
CFRunLoopRunSpecific
GraphicsServices
GSEventRunModal
UIKitCore
-[UIApplication _run]
UIKitCore
UIApplicationMain
libswiftUIKit.dylib
UIKit.UIApplicationMain(Swift.Int32, Swift.UnsafeMutablePointer<Swift.UnsafeMutablePointer<Swift.Int8>>?, Swift.String?, Swift.String?) -> Swift.Int32
Spy
0x100d10000 + 27432
0x0 + 0
Collapse
JoeMatt commented 2 years ago

Not really sure what this could be, other than maybe toView and fromView being equal and causing issues,

I'm going to try this change to test equality

    if let toView = toView, let fromView = fromView, toView != fromView {
      // if we're presenting a view controller, remember the position & dimension
      // of the view relative to the transition container so that we can:
      // - correctly place the view in the transition container when presenting
      // - correctly place the view back to where it was when dismissing
      if isPresenting && !inContainerController {
        originalFrameInContainer = fromView.superview?.convert(
          fromView.frame, to: container
        )
      }
JoeMatt commented 2 years ago

I added this fix to #736 cause I'm too lazy to make a new PR for this :p

sadeghgoo commented 2 years ago

Not really sure what this could be, other than maybe toView and fromView being equal and causing issues,

I'm going to try this change to test equality


    if let toView = toView, let fromView = fromView, toView != fromView {

      // if we're presenting a view controller, remember the position & dimension

      // of the view relative to the transition container so that we can:

      // - correctly place the view in the transition container when presenting

      // - correctly place the view back to where it was when dismissing

      if isPresenting && !inContainerController {

        originalFrameInContainer = fromView.superview?.convert(

          fromView.frame, to: container

        )

      }

No they are not equal.

JoeMatt commented 2 years ago

weird, other than a threading issue not sure why this would crash here.

jgodonQobuz commented 1 year ago

Hi 👋

We have a recurrent crash in production around this issue (actually it's our crash number one in production, by far and at least on iOS 15 & iOS 16)...

Do you have any idea about how to fix this or any workaround to avoid it ?

Thanks for your answer and have a great day

Best regards

Jeremie

Xcode

Capture d’écran 2023-04-05 à 10 38 41

Crashlytics

Capture d’écran 2023-04-05 à 10 37 02
Crashed: com.apple.main-thread
0  Qobuz                          0xa126d4 HeroTransition.start() + 4314769108 (HeroTransition+Start.swift:4314769108)
1  Qobuz                          0xa13770 HeroTransition.animateTransition(using:) + 65 (HeroTransition+UIViewControllerTransitioningDelegate.swift:65)
2  Qobuz                          0xa137b4 @objc HeroTransition.animateTransition(using:) + 4314773428 (<compiler-generated>:4314773428)
3  UIKitCore                      0x489fd0 ___UIViewControllerTransitioningRunCustomTransition_block_invoke_2 + 72
4  UIKitCore                      0x2c8500 +[UIKeyboardSceneDelegate _pinInputViewsForKeyboardSceneDelegate:onBehalfOfResponder:duringBlock:] + 104
5  UIKitCore                      0x33b0c4 ___UIViewControllerTransitioningRunCustomTransition_block_invoke.641 + 176
6  UIKitCore                      0x3c1b84 +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:] + 172
7  UIKitCore                      0x265278 _UIViewControllerTransitioningRunCustomTransition + 572
8  UIKitCore                      0x8903cc __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.401 + 2152
9  UIKitCore                      0x30c234 -[_UIAfterCACommitBlock run] + 64
10 UIKitCore                      0x227764 -[_UIAfterCACommitQueue flush] + 200
11 UIKitCore                      0x155ea4 _runAfterCACommitDeferredBlocks + 640
12 UIKitCore                      0x156570 _cleanUpAfterCAFlushAndRunDeferredBlocks + 128
13 UIKitCore                      0x15673c _afterCACommitHandler + 56
14 CoreFoundation                 0x3e78c <redacted> + 32
15 CoreFoundation                 0xf9b4 <redacted> + 616
16 CoreFoundation                 0x1e1e8 CFRunLoopRunSpecific + 656
17 GraphicsServices               0x1988 GSEventRunModal + 160
18 UIKitCore                      0x4e5a88 -[UIApplication _run] + 1080
19 UIKitCore                      0x27efc8 UIApplicationMain + 336
20 Qobuz                          0xa56c main + 16 (AppDelegate.swift:16)
21 ???                            0x1031084d0 (Manquant)