-
Notifications
You must be signed in to change notification settings - Fork 258
Description
When closing a webview on linux, it closes the entire app as well.
Reproduce Steps
Steps to reproduce the behavior:
- Open a webview
- Close the webview
- Entire app closes
Expected behavior
The webview should close and the app should stay open
Version (please complete the following information):
- Flutter Version: 3.35.4
- OS: Linux
- plugin: [desktop_webview_window: 0.2.3]
Additional context
I've somewhat tracked down what is causing the issue, but I'm not sure the best approach to fix it.
When the webview window initializes the flutter view it eventually registers this callback to unrealize_cb here which is received when the window closes. I think this is shared with the main flutter application, and causes this error.
(webview_window_example:63441): Gdk-ERROR **: 21:38:39.941: The program 'webview_window_example' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAccess (attempt to access private resource denied)'.
(Details: serial 12779 error_code 10 request_code 152 (GLX) minor_code 26)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the GDK_SYNCHRONIZE environment
variable to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Lost connection to device.
Stack trace, showing the issue coming from unrealize_cb
#0 0x00007ffff40ba8d0 in _XError () at /lib/x86_64-linux-gnu/libX11.so.6
#1 0x00007fffdc05fc06 in () at /lib/x86_64-linux-gnu/libGLX_mesa.so.0
#2 0x00007fffdc05fa92 in () at /lib/x86_64-linux-gnu/libGLX_mesa.so.0
#3 0x00007fffe7125492 in () at /lib/x86_64-linux-gnu/libGLX.so.0
#4 0x00007fffe7127813 in () at /lib/x86_64-linux-gnu/libGLX.so.0
#5 0x00007fffe712c277 in () at /lib/x86_64-linux-gnu/libGLX.so.0
#6 0x00007ffff576de7b in () at /lib/x86_64-linux-gnu/libgdk-3.so.0
#7 0x00007ffff5738fd3 in gdk_gl_context_make_current () at /lib/x86_64-linux-gnu/libgdk-3.so.0
#8 0x00007ffff7155057 in unrealize_cb(_FlView*) ()
Just commenting out the lines that setup the flutter view allows the webview to close without taking the rest of the app with it. I haven't been able to find any way to keep it working while also setting up the flutter view
Here is the simple patch im using at the moment to work around the issue
main...commetchat:mixin-flutter-plugins:webview-patch