iPlug2 Forum

WKWebView* pointer causes EXC_BAD_ACCESS in AU Component

Hello all,

Now before we start, I realise that the webview component is experimental, however this is a potential bug that I’ve found. Specifically the IWebView::EvaluateJavaScript void in IPlugWebView.mm

Line 180 ( WKWebView* webView = ( __bridge WKWebView*) mWKWebView;) causes an EXC_BAD_ACCESS code=1.

This happens when EvaluateJavaScript is called while the plugin UI is closed, or closing as the webview object it’s trying to reference is no longer in memory I would assume.
Only happens with AU. VST3 does not cause this exception it would appear (better internal memory access exception handling? shrug).

I’ve tried creating a flag in CloseWebView(), but it doesn’t work to prevent line 180 from being called after the window closes, even if I wrap the whole contents of the EvaluateJavaScript void in an if statement to see if the flag is active.

Would appreciate any input anyone else has! Thank you.

Thanks for the report. There is a bug here where AUv2 plug-ins using WebViewEditorDelegate don’t call CloweWebView()… working on a fix

1 Like

Thank you for the very quick response!

Should be fixed now: WebViewEditorDelegate: Fix crash when closing the UI in AUv2 plug-ins. · iPlug2/iPlug2@f3be31f · GitHub

1 Like

Thank you so much! This has certainly fixed the issue.

Note: For anyone else reading this and performing a git pull, you’ll need to edit your Build Phases for each target in XCode to remove the “-fobjc-arc” compiler flag from every file in the Compile Sources section, except on IPlugWebView.mm