-
-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Crash for Call Should be on Main Thread #1371
Conversation
The swizzling of subclasses of UIViewController stored references to classes on a background thread, which led to calling the initialize method. Some UIViewControllers implementing assume that they are on the main thread when executing initialize. Calling initialize from a background thread can lead to crashes. This is fixed now by avoiding the call to initialize on a background thread and swizzling on the main thread. Fixes GH-1366
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
testAsyncStacktraces should be testing if stack traces of different threads are stitched together, which it didn't do, because we were only building the stack trace on the main thread. This is fixed now by building the stack trace across different threads. Furthermore, the tests now use its own queue to avoid side effects when testing.
testAsyncStacktraces should be testing if stack traces of different threads are stitched together, which it didn't do, because we were only building the stack trace on the main thread. This is fixed now by building the stack trace across different threads. Furthermore, the tests now use its own queue to avoid side effects when testing.
Codecov Report
@@ Coverage Diff @@
## master #1371 +/- ##
==========================================
+ Coverage 95.45% 95.60% +0.15%
==========================================
Files 153 152 -1
Lines 5500 5509 +9
==========================================
+ Hits 5250 5267 +17
+ Misses 250 242 -8
Continue to review full report at Codecov.
|
📜 Description
The swizzling of subclasses of UIViewController stored
references to classes on a background thread, which led
to calling the initialize method. Some UIViewControllers
implementing assume that they are on the main thread
when executing initialize. Calling initialize from a
background thread can lead to crashes. This is fixed now
by avoiding the call to initialize on a background thread and
swizzling on the main thread.
💡 Motivation and Context
Fixes GH-1366
💚 How did you test it?
Unit tests, UI tests, on a real device and with the sample project pointed out in GH-1366.
📝 Checklist
🔮 Next steps