Hello!!
The newly released JUCE 8 is fantastic, and developing with JUCE is a truly enjoyable experience! I am experimenting with the new WebViewPluginDemo to see if I can build my plugin’s UI using web technologies.
While creating my plugin based on the WebViewPluginDemo, I noticed something. When the Timer in WebViewPluginDemo is set to 30Hz, and the plugin is repeatedly opened and closed, it consistently crashes.
The steps to reproduce this are as follows:
- From Projucer, go to Open Examples → Plugins → WebViewPluginDemo and set up the project.
- Open Visual Studio 2022 and change the Timer execution frequency to 30Hz. Specifically, at the location indicated in this link, set startTimerHz (30);
JUCE/examples/Plugins/WebViewPluginDemo.h at master · juce-framework/JUCE · GitHub - Build the project and load the VST3 in the AudioPluginHost included with JUCE.
- Repeatedly open and close the plugin window. After a few repetitions, it will crash.
Attached is an image of the call stack result from Visual Studio 2022. Since part of it is cut off, I have included the entire call stack below.
> WebViewPluginDemo.vst3!juce::ReferenceCountedObjectPtr<juce::AsyncUpdater::AsyncUpdaterMessage>::operator->() Line 406 C++
WebViewPluginDemo.vst3!juce::AsyncUpdater::triggerAsyncUpdate() Line 80 C++
WebViewPluginDemo.vst3!juce::WebBrowserComponent::Impl::Platform::WebView2::createWebView::__l5::<lambda>(HRESULT __formal, ICoreWebView2Controller * controller) Line 1103 C++
[External Code]
AudioPluginHost.exe!juce::InternalMessageQueue::dispatchNextMessage(bool returnIfNoPendingMessages) Line 151 C++
AudioPluginHost.exe!juce::detail::dispatchNextMessageOnSystemQueue(bool returnIfNoPendingMessages) Line 274 C++
AudioPluginHost.exe!juce::MessageManager::runDispatchLoop() Line 124 C++
AudioPluginHost.exe!juce::JUCEApplicationBase::main() Line 277 C++
AudioPluginHost.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) Line 391 C++
[External Code]
As a clue to solving the problem, it seems that this crash is caused by the following code, but I can’t figure it out with my current knowledge. I’m not sure the solution.
// from https://github.com/juce-framework/JUCE/blob/master/modules/juce_gui_extra/native/juce_WebBrowserComponent_windows.cpp#L1103
if (! weakThis->webView2ConstructionHelper.viewsWaitingForCreation.empty())
(*weakThis->webView2ConstructionHelper.viewsWaitingForCreation.begin())->triggerAsyncUpdate();
How can this be resolved?

