You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've created a WebView which responds to a URL change event.
The crash happens most often when calling a delegate multiple times very quickly, but have been able to reproduce when my WebView isn't completely instantiated on first load as well (although rare). If I click a button in my WebView that changes the URL even three times very quickly, I get the crash every time.
Since EXC_BAD_ACCESS commonly relates to referencing an object which no longer exists, I saw this line as suspect in MochaJSDelegate:
Somewhere along the way of using eval and calling the two anonymous functions (see also dynamicHandler function), a disconnect exists with memory management. Note that with my workaround, I'm unable to access the function parameters in my delegate function, so it's not a real solution for the MochaJSDelegate library.
As a result I ended up creating the class delegate manually myself (allowing me to access arguments), but it'd be nice if I could have both arguments and no crashing in the current lib so I don't have to do it manually in my app.
If you have any ideas with that broad overview let me know! I can setup an example if you aren't sure just based on that information where the issue is.
Thanks!
The text was updated successfully, but these errors were encountered:
Thanks for the detailed issue! This is interesting, as I've seen similar issues, but been unable to track down the exact point of error. Will look into this.
Hey Matt - little update for you! What I listed above about a race condition / memory allocation issue is still valid, but I've tracked down a telling side effect.
In Googling some more about unrelated issues, I noticed a closed issue in this repo about a delegate having the wrong number of parameters crashing the application. Sure enough, I removed some of the parameters off the delegate and I was able to determine that I can only reliably depend on the first two parameters here:
I've created a WebView which responds to a URL change event.
The crash happens most often when calling a delegate multiple times very quickly, but have been able to reproduce when my WebView isn't completely instantiated on first load as well (although rare). If I click a button in my WebView that changes the URL even three times very quickly, I get the crash every time.
Since
EXC_BAD_ACCESS
commonly relates to referencing an object which no longer exists, I saw this line as suspect in MochaJSDelegate:If I replace with this, it works flawlessly:
Somewhere along the way of using
eval
and calling the two anonymous functions (see alsodynamicHandler
function), a disconnect exists with memory management. Note that with my workaround, I'm unable to access the function parameters in my delegate function, so it's not a real solution for the MochaJSDelegate library.As a result I ended up creating the class delegate manually myself (allowing me to access arguments), but it'd be nice if I could have both arguments and no crashing in the current lib so I don't have to do it manually in my app.
If you have any ideas with that broad overview let me know! I can setup an example if you aren't sure just based on that information where the issue is.
Thanks!
The text was updated successfully, but these errors were encountered: