fix: prevent crashes during onuncaughterror#141
Merged
NathanWalker merged 2 commits intoNativeScript:release/8-2from Feb 9, 2022
Merged
fix: prevent crashes during onuncaughterror#141NathanWalker merged 2 commits intoNativeScript:release/8-2from
NathanWalker merged 2 commits intoNativeScript:release/8-2from
Conversation
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Adam Bird.
|
daeabad to
fc011d3
Compare
Contributor
|
We will release this in the next 8.2.x alpha shortly thank you for this. |
Contributor
|
In 8.2.0-alpha.6 now. |
NathanWalker
pushed a commit
that referenced
this pull request
Mar 7, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR aims to address some unwanted crashes that would happen during the
OnUncaughtErrorhandler.The first relates to how the
AppPackageJsonfile was being read to fetch thediscardUncaughtJsExceptionsflag. The NSJSONSerialization would produce a NSDictionary that would get autoreleased. On subsequent calls toOnUncaughtError, theAppPackageJsonpointer would be cleared causing a bad access.To address this, I alloc and init a new NSDictionary from the serialization so that this dictionary will not get released between calls to
OnUncaughtError. I'm not super familiar with Objective-C or how this runtime is setup, so I don't know if there is a point where we should manually release this dictionary. Please let me know if this should be handled.Second, I ran into an unhelpful stack trace when trying to test the error events I setup and eventually realized that my event handlers were also causing a javascript exception, but since we were already in the
OnUncaughtErrormethod, thetns::Assertwould be false and quit the app. I addressed this by usingTryCatchand logging the caught error so developers have visibility on if their error event handlers are also causing an error.This PR will most likely close #126 and possibly is related to some crashes other users have reported.