MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Calling Close on an ICoreWebView2Controller instance pumps messages

Open
#3,140 0 comments 1 reaction 1 assignee View on GitHub

@champnic is already working on this.

Since Jan 23, 2023.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

ICoreWebView2Controller::Close is a synchronous call, but apparently it manually pumps messages, creating unwanted reentrancy...

Proof: I call Close from a posted message handler, right after having posted another message, and and while Close has not returned yet, my other message handler is called.

the pseudo stack would be looks like:
messageA handler
post messageB
ICoreWebView2Controller::Close
messageB handler
// End of messageB handler
// End of ICoreWebView2Controller::Close
// End of messageA handler

This is really bad. It's known for ages that manually pumping messages is a very bad practice, and there's only very few cases where it's necessary (but never hidden in a black box as here, too dangerous).

As a consequence, I have to add some dirty code to avoid a crash, and I can't do nothing clean about it. So please, look into this and fix it.

It seems it appeared since the last evergreen runtime update, but I can't verify whether it's a regression or not, as it's impossible to downgrade webview2 to compare....
EDIT: I finally found a way to test with the previous runtime version available 108.0.1462.76, and the problem doesn't exist.

It may be related to #3141 .

SDK: 1.0.1518.46
Runtime: 109.0.1518.52
Framework: MFC
OS: Win10

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.