uias / Pageboy

📖 A simple, highly informative page view controller
MIT License
1.99k stars 154 forks source link

NSInternalInconsistencyException in PatchedPageViewController #286

Open martin-muller opened 1 year ago

martin-muller commented 1 year ago

Hi, we're using Pageboy through Tabman, both on their latest version, and we've received crash report pointing to Pageboy.

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x9e48 __exceptionPreprocess
1  libobjc.A.dylib                0x178d8 objc_exception_throw
2  Foundation                     0x54594c _userInfoForFileAndLine
3  UIKitCore                      0x79cf28 -[_UIQueuingScrollView _enqueueCompletionState:]
4  UIKitCore                      0x79d1f8 -[_UIQueuingScrollView _enqueueAnimatedScrollInDirection:withView:completion:]
5  UIKitCore                      0x79e0b8 -[_UIQueuingScrollView setView:direction:animated:completion:]
6  UIKitCore                      0x791bdc -[UIPageViewController _setViewControllers:withScrollInDirection:animated:completion:]
7  UIKitCore                      0x791da0 -[UIPageViewController setViewControllers:direction:animated:completion:]
8  WorkAngel                      0x166c3e8 PatchedPageViewController.setViewControllers(_:direction:animated:completion:) (<compiler-generated>)
9  WorkAngel                      0x166c848 @objc PatchedPageViewController.setViewControllers(_:direction:animated:completion:) (<compiler-generated>)
10 WorkAngel                      0x1660370 closure #2 in PageboyViewController._updateViewControllers(to:from:to:direction:animated:async:force:completion:) (<compiler-generated>)
11 WorkAngel                      0x1661814 partial apply for closure #2 in PageboyViewController._updateViewControllers(to:from:to:direction:animated:async:force:completion:) (<compiler-generated>)
12 WorkAngel                      0x1661868 partial apply for closure #3 in PageboyViewController._updateViewControllers(to:from:to:direction:animated:async:force:completion:) (<compiler-generated>)
13 WorkAngel                      0x166c284 thunk for @escaping @callee_guaranteed () -> () (<compiler-generated>)
14 libdispatch.dylib              0x24b4 _dispatch_call_block_and_release
15 libdispatch.dylib              0x3fdc _dispatch_client_callout
16 libdispatch.dylib              0x127f4 _dispatch_main_queue_drain
17 libdispatch.dylib              0x12444 _dispatch_main_queue_callback_4CF
18 CoreFoundation                 0x9a6d8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
19 CoreFoundation                 0x7c03c __CFRunLoopRun
20 CoreFoundation                 0x80ec0 CFRunLoopRunSpecific
21 GraphicsServices               0x1368 GSEventRunModal
22 UIKitCore                      0x3a186c -[UIApplication _run]
23 UIKitCore                      0x3a14d0 UIApplicationMain
24 WorkAngel                      0x7d30 main + 20 (main.m:20)
25 ???                            0x1d863a960 (Missing)

The closest issue I found is relatively recently fixed https://github.com/uias/Pageboy/issues/277. We weren't able to reproduce the issue locally, but going through the code, I'm thinking if the isSettingsViewControllers (https://github.com/uias/Pageboy/blob/4.0.2/Sources/Pageboy/Utilities/PatchedPageViewController.swift#L13) flag should be locked to avoid any potential races?

aj2109 commented 10 months ago

Hi just going to bump the above as haven't seen any progress on making the suggested changes, thanks!