-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[v2] runtime.SomeDialog causes application to crash on linux #1402
Comments
Thanks for the very detailed report Jack 🙏 It's very likely to be a threading issue, but interesting that @ianmjones hasn't seen this. |
Would be interesting to see if PR #1392 would fix this issue. |
Happy to help @leaanthony - you are both onto something with the threading. @stffabi interestingly your PR #1392 has some positive effect on the problem, but does not resolve the issue completely. Using #1392 the dialog windows themselves open as expected (excellent!) (see screenshots below). I am able to navigate around the file system and highlight files/folders etc... The problems resume however, when trying to either 'Cancel' the dialog, or 'Open' the selected files/folders. When trying to interact with the Dialog's native buttons, the application crashes again. This appears to be the case with each of the Using the same PR, the application still functions as expected and dialog windows remain responsive on windows. It appears GTK may be somewhat involved, as I get the following errors in the terminal, only when clicking a dialog native button (like 'Cancel' or 'OK'): Ubuntu: Dialog 2 callback fires
(boilerplate-dev-linux-amd64:1246185): Gtk-CRITICAL **: 02:48:18.525: gtk_window_set_transient_for: assertion 'parent == NULL || GTK_IS_WINDOW (parent)' failed Fedora: (process:27238): GLib-CRITICAL **: 02:53:59.671: Failed to set scheduler settings: Operation not permitted
Dialog 2 callback fires
(boilerplate-dev-linux-amd64:27210): Gtk-CRITICAL **: 02:54:01.700: gtk_window_set_transient_for: assertion 'parent == NULL || GTK_IS_WINDOW (parent)' failed Thanks for the quick response on this one guys - I'll have a look into it also, but I must be honest, GTK is not my forte! Though I suppose it might just be that GTK is looking for something on the wrong thread? Let me know if there's anything more I can do! |
@lambdajack Thanks for testing #1392 I was able to reproduce the problem on my latest Fedora on arm64. It seems like it get's triggered when the dialogs are opened through the menu callback. From the message "is not responding" I suspected that the main thread is somehow blocked and this stopped GTK from processing messages for the native part. Adding a At line 28 we are waiting for the results of the dialog and that's going to block the message loop since OpenFileDialog is called from the menu callback which is on the main thread: wails/v2/internal/frontend/desktop/linux/dialog.go Lines 26 to 33 in 35b1dfd
I think we should call the menu click callbacks on a new goroutine and that should fix the issue. @leaanthony do you see a problem with that? |
Great stuff @stffabi! #1403 works as expected on ubuntu, fedora and windows for me. I wasn't able to cause a crash on that PR. I am still seeing console errors on linux when pressing the menu button to open the dialog, but they don't appear to be fatal as the application remains responsive and the function return values are as expected, even after many dialog open/close ops: Windows shows no console errors. Ubuntu: Dialog 1 callback fires
(boilerplate-dev-linux-amd64:1380611): Gtk-CRITICAL **: 08:27:01.937: gtk_window_set_transient_for: assertion 'parent == NULL || GTK_IS_WINDOW (parent)' failed Fedora: Dialog 1 callback fires
(boilerplate-dev-linux-amd64:31086): Gtk-CRITICAL **: 08:28:51.894: gtk_window_set_transient_for: assertion 'parent == NULL || GTK_IS_WINDOW (parent)' failed
|
@lambdajack Awesome thanks so much for testing it and your feedback. Yeah, I've just pushed a new commit to the PR, which fixes those assertion messages. |
Description
Calling
runtime.OpenDirectorDialog
(or any of the dialog options described in the docs here) causes the application to crash on linux.Tested on fresh ubuntu and fedora updated vms (as well as bare metal ubuntu).
The exact same application works as expected in windows.
To Reproduce
wails init -n menutest -t react-ts
Greet
function dependency from the frontend if you copied/pasted the above.wails dev
orwails build
Expected behaviour
The dialog options should open on linux the same way they do on windows.
Screenshots
Fig1 - application crash on ubuntu
Fig2 - application crash on fedora
Fig3 - working on windows
Attempted Fixes
I have tried implementing the menu without using the
menu.NewMenuFromItems
helper function, however the problem remains.I have also tried on
master
.System Details
2: FEDORA:
The text was updated successfully, but these errors were encountered: