Skip to content
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

Multiple instances of a CHOC WebView Fails in Windows #52

Closed
jackkilgore opened this issue Apr 2, 2024 · 2 comments
Closed

Multiple instances of a CHOC WebView Fails in Windows #52

jackkilgore opened this issue Apr 2, 2024 · 2 comments

Comments

@jackkilgore
Copy link

jackkilgore commented Apr 2, 2024

The Issue:

I am helping with development of two audio plugins, let's call them A and B for simplicity. When I load in A and then B with the WebView of A still open, the WebView of B is blank. Loading them by themselves has no issues. Also note that if I run multiple instances of B the issue does not occur.

When doing some digging, I saw that the constructor of choc::ui::Webview is failing.
The following code prints out false.

webView = std::make_unique<choc::ui::WebView>(opts);
std::cout << webView->loadedOK() << std::endl;

After doing some more digging I noticed that the PIMPL constructor is failing.
The line hwnd = windowClass.createWindow (WS_POPUP, 400, 400, this); returns a null pointer. This can be fixed by changing the first parameter of WindowClass windowClass { L"CHOCWebView", (WNDPROC) wndProc }; to something unique. WindowClass windowClass { L"CHOCWebView", (WNDPROC) wndProc }; -> WindowClass windowClass { L"CHOCWebViewB", (WNDPROC) wndProc };. This fixes when hwnd is null, but it unfortunately doesn't fix the entire issue.

Now the issue is that createEmbeddedWebView() is returning false because coreWebView is null. After doing some tracing, this has lead to HRESULT STDMETHODCALLTYPE Invoke (HRESULT, ICoreWebView2Controller* controller) override. This function seems to be called by the Window's WebView2 specifically . The controller is a null pointer only in the failing issue stated above.

I'm not sure what do as this gets into WebView2 calls.

If you need help replicating the bug let me know!

@julianstorer
Copy link
Collaborator

This sounds like a bug that I fixed yesterday - try the latest version!
There was a discussion about it all on discord, you might want to check it out: https://discord.com/channels/382895736356077570/1218213251553165393

@jackkilgore
Copy link
Author

Woah. What are the odds :000

It fixed our issue once we update CHOC in both plugins, thanks so much!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants