Crash in BrowserViewController: Application tried to present modally an active controller

RESOLVED FIXED in 2.0

Status

()

Firefox for iOS
General
--
critical
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: aaronmt, Assigned: fluffyemily)

Tracking

({crash, reproducible})

unspecified
All
iOS
crash, reproducible

Firefox Tracking Flags

(fxios2.0+)

Details

Attachments

(1 attachment)

48 bytes, text/x-github-pull-request
bnicholson
: review+
Details | Review | Splinter Review
(Reporter)

Description

2 years ago
On an iPad:

* Open the share sheet menu
* Tap more
* Background the application


2016-02-10 11:40:55.457 Client[1657:650540] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller <Client.BrowserViewController: 0x7f893a840800>.'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000110a63e65 __exceptionPreprocess + 165
	1   libobjc.A.dylib                     0x000000010fd83deb objc_exception_throw + 48
	2   UIKit                               0x0000000111a0f117 -[UIViewController _presentViewController:withAnimationController:completion:] + 5165
	3   UIKit                               0x0000000111a11c50 __62-[UIViewController presentViewController:animated:completion:]_block_invoke_2 + 70
	4   UIKit                               0x00000001119111b8 +[UIView(Animation) performWithoutAnimation:] + 65
	5   UIKit                               0x0000000111a11be6 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 365
	6   UIKit                               0x0000000111a11f2c -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 489
	7   UIKit                               0x0000000111a11a3b -[UIViewController presentViewController:animated:completion:] + 179
	8   Client                              0x000000010dfb9890 _TFFC6Client21BrowserViewController24viewWillTransitionToSizeFS0_FTVSC6CGSize25withTransitionCoordinatorPSo37UIViewControllerTransitionCoordinator__T_U_FPSo44UIViewControllerTransitionCoordinatorContext_T_ + 624
	9   Client                              0x000000010ddbd687 _TTRXFo_oPSo44UIViewControllerTransitionCoordinatorContext__dT__XFo_iPS___iT__ + 23
	10  Client                              0x000000010df724b1 _TPA__TTRXFo_oPSo44UIViewControllerTransitionCoordinatorContext__dT__XFo_iPS___iT__ + 81
	11  Client                              0x000000010ddbd6c0 _TTRXFo_iPSo44UIViewControllerTransitionCoordinatorContext__iT__XFo_oPS___dT__ + 32
	12  Client                              0x000000010ddbd708 _TTRXFo_oPSo44UIViewControllerTransitionCoordinatorContext__dT__XFdCb_dPS___dT__ + 56
	13  UIKit                               0x000000011226f77d -[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] + 300
	14  UIKit                               0x000000011226bfdd -[_UIViewControllerTransitionContext _runAlongsideCompletions] + 149
	15  UIKit                               0x000000011226bd30 -[_UIViewControllerTransitionContext completeTransition:] + 117
	16  UIKit                               0x0000000111e7db93 __58-[_UIWindowRotationAnimationController animateTransition:]_block_invoke_2204 + 26
	17  UIKit                               0x000000011191734e +[UIView(Internal) _performBlockDelayingTriggeringResponderEvents:] + 188
	18  UIKit                               0x0000000111e7db44 __58-[_UIWindowRotationAnimationController animateTransition:]_block_invoke203 + 124
	19  UIKit                               0x0000000111e7d673 -[_UIWindowRotationAnimationController animateTransition:] + 575
	20  UIKit                               0x00000001118da8fa -[UIWindow _rotateToBounds:withAnimator:transitionContext:] + 656
	21  UIKit                               0x00000001118dd750 -[UIWindow _rotateWindowToOrientation:updateStatusBar:duration:skipCallbacks:] + 2047
	22  UIKit                               0x00000001118de249 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 842
	23  UIKit                               0x00000001118dcd7c -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 184
	24  UIKit                               0x00000001118db9cd __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 107
	25  UIKit                               0x00000001118db805 -[UIWindow _updateToInterfaceOrientation:duration:force:] + 486
	26  UIKit                               0x0000000111baeebb -[UIScreen _notifySceneBoundsChanged:] + 423
	27  UIKit                               0x0000000111babdcb -[UIScreen _computeMetrics:] + 2088
	28  UIKit                               0x0000000111bab4c9 -[UIScreen _updateReferenceBoundsToSceneReferenceBounds:fromInterfaceOrientation:animated:] + 458
	29  UIKit                               0x0000000111bab2e7 -[UIScreen _updateWithMainSceneSettings:animated:] + 199
	30  UIKit                               0x000000011187129d __83-[UIApplication _createSnapshotContextForScene:withName:performLayoutWithSettings:]_block_invoke_2 + 37
	31  UIKit                               0x0000000111a0b1ed +[UIViewController _performWithoutDeferringTransitions:] + 110
	32  UIKit                               0x000000011187124a __83-[UIApplication _createSnapshotContextForScene:withName:performLayoutWithSettings:]_block_invoke + 140
	33  UIKit                               0x00000001119111b8 +[UIView(Animation) performWithoutAnimation:] + 65
	34  UIKit                               0x0000000111870dea -[UIApplication _createSnapshotContextForScene:withName:performLayoutWithSettings:] + 487
	35  UIKit                               0x000000011187261f __65-[UIApplication _performSnapshotsWithAction:forScene:completion:]_block_invoke_2 + 116
	36  FrontBoardServices                  0x0000000113bac171 -[FBSSceneSnapshotAction _executeNextRequest] + 214
	37  FrontBoardServices                  0x0000000113babde8 -[FBSSceneSnapshotAction executeRequestsWithHandler:completionHandler:expirationHandler:] + 218
	38  UIKit                               0x0000000111872564 __65-[UIApplication _performSnapshotsWithAction:forScene:completion:]_block_invoke + 305
	39  UIKit                               0x0000000111871ad2 -[UIApplication _beginSnapshotSessionForScene:withSnapshotBlock:] + 1138
	40  UIKit                               0x00000001118723f2 -[UIApplication _performSnapshotsWithAction:forScene:completion:] + 629
	41  UIKit                               0x00000001118720fc -[UIApplication _handleSnapshotAction:forScene:completion:] + 153
	42  UIKit                               0x000000011186e004 __102-[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]_block_invoke1984 + 290
	43  UIKit                               0x000000011186dc20 __102-[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]_block_invoke1970 + 942
	44  UIKit                               0x00000001118714a2 _runAfterCACommitDeferredBlocks + 317
	45  UIKit                               0x0000000111884c01 _cleanUpAfterCAFlushAndRunDeferredBlocks + 95
	46  UIKit                               0x0000000111890af3 _afterCACommitHandler + 90
	47  CoreFoundation                      0x000000011098f367 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
	48  CoreFoundation                      0x000000011098f2d7 __CFRunLoopDoObservers + 391
	49  CoreFoundation                      0x0000000110984f2b __CFRunLoopRun + 1147
	50  CoreFoundation                      0x0000000110984828 CFRunLoopRunSpecific + 488
	51  GraphicsServices                    0x0000000114a07ad2 GSEventRunModal + 161
	52  UIKit                               0x0000000111865610 UIApplicationMain + 171
	53  Client                              0x000000010df68b77 main + 487
	54  libdyld.dylib                       0x0000000116e7e92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(Assignee)

Updated

2 years ago
Assignee: nobody → etoop
Status: NEW → ASSIGNED
Can't reproduce with those steps on iPad mini with either 8.3 or 9.2.1.
(Assignee)

Comment 2

2 years ago
I can (In reply to Richard Newman [:rnewman] from comment #1)
> Can't reproduce with those steps on iPad mini with either 8.3 or 9.2.1.

I can reproduce on an iPad Air2 on 9.2.1.
(Assignee)

Comment 3

2 years ago
Bug is caused by some code in `viewWillTransitionToSize` which, when called, dismisses any presented view controller and represents in the new size. However, because when the animation occurs the view is no longer being displayed at all (viewWillTransitiionToSize gets called on backgrounding) it crashes as it has nothing to present the view from.

I'm proposing to fix this by dismissing the presented view controller on backgrounding and ensuring that the animation only occurs if the presented view controller is currently being presented.
(Assignee)

Comment 4

2 years ago
Created attachment 8717974 [details] [review]
Pull request
Attachment #8717974 - Flags: review?(bnicholson)
Comment on attachment 8717974 [details] [review]
Pull request

Works great!
Attachment #8717974 - Flags: review?(bnicholson) → review+
(Assignee)

Updated

2 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
(Assignee)

Updated

2 years ago
tracking-fxios: ? → 2.0+
Target Milestone: --- → 2.0

Updated

2 years ago
Blocks: 1247911

Updated

2 years ago
No longer blocks: 1247911
Depends on: 1247911

Updated

2 years ago
No longer depends on: 1247911

Updated

2 years ago
Depends on: 1247911
You need to log in before you can comment on or make changes to this bug.