calimarkus / JDStatusBarNotification

Highly customizable & feature rich notifications. Interactive dismiss. Custom Views. SwiftUI. Tap-to-hold. Progress. Written in Swift, compatible for ObjC!
http://calimarkus.github.io/JDStatusBarNotification/documentation/jdstatusbarnotification
MIT License
4.22k stars 561 forks source link

Recursive Crash on iOS 8.3 #40

Closed waltsellers closed 9 years ago

waltsellers commented 9 years ago

We are getting a recursive crash when JDStatusBarNotification usage is close in time to a UIAlertView being presented. This reproduces in the 8.3 simulator with Xcode 6.3.

It appears the window is calling supportedInterfaceOrientations on JDStatusBarNotificationViewController, and it is then asking the window the same.

The crash logs truncate the early part of the call stack, but from the Xcode stacks: ....

130769 0x0000000102a1e59a in -[JDStatusBarNotificationViewController supportedInterfaceOrientations]

130770 0x00000001053d2569 in -[_UIAlertShimPresentingViewController supportedInterfaceOrientations]()

130771 0x0000000102a1e59a in -[JDStatusBarNotificationViewController supportedInterfaceOrientations]

130772 0x00000001053d2569 in -[_UIAlertShimPresentingViewController supportedInterfaceOrientations]()

130773 0x0000000102a1e59a in -[JDStatusBarNotificationViewController supportedInterfaceOrientations]

130774 0x00000001053d2569 in -[_UIAlertShimPresentingViewController supportedInterfaceOrientations]()

130775 0x0000000102a1e59a in -[JDStatusBarNotificationViewController supportedInterfaceOrientations]

130776 0x00000001053d2569 in -[_UIAlertShimPresentingViewController supportedInterfaceOrientations]()

130777 0x0000000104dff380 in -[UIViewController __supportedInterfaceOrientations]()

130778 0x0000000104dff768 in -[UIViewController __withSupportedInterfaceOrientation:apply:]()

130779 0x0000000104dffd71 in -[UIViewController setInterfaceOrientation:]()

130780 0x0000000104df0ba3 in -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]()

130781 0x0000000104d35a05 in -[UIView(Internal) _didMoveFromWindow:toWindow:]()

130782 0x0000000104d2decf in __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke ()

130783 0x0000000104d2de43 in -[UIView(Hierarchy) _postMovedFromSuperview:]()

130784 0x0000000104d37f48 in -[UIView(Internal) _addSubview:positioned:relativeTo:]()

130785 0x0000000104d06470 in -[UIWindow addRootViewControllerViewIfPossible]()

130786 0x0000000104d06c6d in -[UIWindow setRootViewController:]()

130787 0x00000001053d3a3c in -[_UIAlertControllerShimPresenterWindow _presentationViewController]()

130788 0x00000001053d3a96 in -[_UIAlertControllerShimPresenterWindow presentAlertController:animated:completionBlock:]()

130789 0x00000001053d26b2 in -[_UIAlertControllerShimPresenter _presentAlertControllerAnimated:completion:]()

130790 0x0000000104f2ab19 in -[UIAlertView _showAnimated:]()

waltsellers commented 9 years ago

Looks like the latest version fixes it.

waltsellers commented 9 years ago

Just so people can find this by the text in the crash log:

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_PROTECTION_FAILURE at 0x012a2ffc Triggered by Thread: 0

Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libsystem_pthread.dylib 0x36a0b7b6 mtx_droplock + 274 1 libsystem_pthread.dylib 0x36a0818e pthread_mutex_unlock + 34 2 Foundation 0x28c4f678 -[NSLock unlock] + 172 3 Foundation 0x28de8daa -[NSBundleTables bundleForClass:] + 106 4 Foundation 0x28c5160a +[NSBundle bundleForClass:] + 190 5 UIKit 0x2b61c1c8 -[UIWindow isInternalWindow] + 72 6 UIKit 0x2b8afd08 -[UIWindow _canAffectStatusBarAppearance] + 16 7 UIKit 0x2b90b516 __42-[UIViewController _windowForAutorotation]_block_invoke + 22 8 UIKit 0x2b61ca94 +[UIWindow _topVisibleWindowPassingTest:] + 144 9 UIKit 0x2b90b4f6 -[UIViewController _windowForAutorotation] + 118 10 UIKit 0x2b90b57c -[UIViewController _primaryViewControllerForAutorotation] + 16 11 UIKit 0x2bcbc6fa -[_UIAlertShimPresentingViewController supportedInterfaceOrientations] + 22 12 OurApp 0x005c8962 -JDStatusBarNotificationViewController supportedInterfaceOrientations 13 UIKit 0x2bcbc712 -[_UIAlertShimPresentingViewController supportedInterfaceOrientations] + 46 14 OurApp 0x005c8962 -JDStatusBarNotificationViewController supportedInterfaceOrientations 15 UIKit 0x2bcbc712 -[_UIAlertShimPresentingViewController supportedInterfaceOrientations] + 46

cmds4410 commented 9 years ago

@jaydee3 was this fixed by mainApplicationWindowIgnoringWindow in JDStatusBarNotification.m?