wailsapp / go-webview2

The Wails fork of go-webview2
Other
37 stars 18 forks source link

WebView2 process crash with version prior to 118.0.2088.76 on Windows #24

Open SuperDumbTM opened 5 days ago

SuperDumbTM commented 5 days ago

Duplicate the issue (https://github.com/wailsapp/wails/issues/3913) here for tracking.

Summary

An error message "The WebView2 process crashed and the application needs to be restarted" will show up when the GUI window is being "refocused" (mouse click on somewhere else and then click the app's window).

The incompatible versions seem to be 117.0.2045.60 and prior for Wails v2.9.2.

SuperDumbTM commented 5 days ago

I have tested that invoking WindowMinimise and then WindowUnminimise can trigger this error.

Combining with Github release API, one can simply pull all the WebView2 binary from WebView2RuntimeArchive and test whether an app will crash against each version.

If WebView2 error occurs, an error "ERR | WebVie2wProcess failed with kind 0" will appear. image

But I'm not sure how to gather the piece above into an automated test.

xiexul commented 5 days ago

I tested the borderless application and implemented a custom toolbar that crashes when zooming in, out, or closing(Quit). When dragging the window position, it also crashes. It seems that whenever the runtime is called, a crash exception occurs:”The WebView2 processcrashed and the application needs to be restarted“ image image

But when I drag using the native title bar, this exception does not occur

The incompatible versions seem to be 113.0.1774.50 and prior for Wails v2.9.2.

leaanthony commented 5 days ago

Have you tried using replace to downgrade the go-webview2 version ?

xiexul commented 4 days ago

Have you tried using replace to downgrade the go-webview2 version ?

I tested downgrading go-webview2 to 1.0.13 and working fine, and getting higher than 1.0.13 was wiped out

leaanthony commented 1 day ago

@SuperDumbTM - Looking at the features we use, we don't support any post 117.0.2045.60 specific apis so it should be ok. I have pushed up a commit to better handle the EnvironmetCompleted callback. Could you please try that? Thanks.

Snshadow commented 1 day ago

According to the change from https://github.com/wailsapp/go-webview2/compare/v1.0.13...v1.0.14, the change has been made for MoveFocus to use a pointer for a reason from using a enum value itself. However, when looking at the api specification, looks like it needs to take a enum value itself, however versions later then v1.0.13 would call

MoveFocus(pointer value of a value) 

instead of

MoveFocus(0~2)

as in the enum specification. I think that this would be the cause of the crash as it would cause an error like this, and maybe the version later then 118 has a way to avoid the crash for the failure.

What bug did this fix resolve?

leaanthony commented 23 hours ago

Good catch! Yeah, this may have been done in error. It was a while back now so no idea why. I've reverted the commit. If you use the replace directive and use github.com/wailsapp/go-webview2@e53758943f0fbd774dcc2ce5229cd1d082308cca and let me know if that fixes it 🙏

Snshadow commented 19 hours ago

@leaanthony Reverting the commit indeed fixes the crash when changing the focus for me. @SuperDumbTM, @xiexul could you check if this fixes the issue too?

leaanthony commented 4 minutes ago

I've released v1.0.18 with this revert in it. Updated deps on master for Wails v2. If you have the time it would be great to get your feedback on whether master fixes your issues (it should!) and if so, I'll look at doing a release later tonight. Really appreciate all your time tracking this down 🙏