MacOS: Window stays open frozen when gdk_main_quit is called upon destroy. Doesn't happen on other platforms
Steps to reproduce
I'm afraid I've not tested this outside of the julia Gtk.jl system, but the sequence is simple. (In the mean-time, I plan to rule out this being a julia issue via a native c example, but wondered if this is a known bug?)
UPDATE: See the comment below for a C reproducer via the brew distribution
- Create a window
- Connect gtk_main_quit to the destroy signal
- Close window
pkg> add Gtk
...
julia> using Gtk
julia> win = Gtk.Window() # this calls gtk_main and shows the window properly
GtkWindowLeaf(name="", parent, width-request=-1, height-request=-1, visible=TRUE, sensitive=TRUE, app-paintable=FALSE, can-focus=FALSE, has-focus=FALSE, is-focus=FALSE, focus-on-click=TRUE, can-default=FALSE, has-default=FALSE, receives-default=FALSE, composite-child=FALSE, style, events=0, no-show-all=FALSE, has-tooltip=FALSE, tooltip-markup=NULL, tooltip-text=NULL, window, opacity=1.000000, double-buffered, halign=GTK_ALIGN_FILL, valign=GTK_ALIGN_FILL, margin-left, margin-right, margin-start=0, margin-end=0, margin-top=0, margin-bottom=0, margin=0, hexpand=FALSE, vexpand=FALSE, hexpand-set=FALSE, vexpand-set=FALSE, expand=FALSE, scale-factor=2, border-width=0, resize-mode, child, type=GTK_WINDOW_TOPLEVEL, title=NULL, role=NULL, resizable=TRUE, modal=FALSE, window-position=GTK_WIN_POS_NONE, default-width=-1, default-height=-1, destroy-with-parent=FALSE, hide-titlebar-when-maximized=FALSE, icon, icon-name=NULL, screen, type-hint=GDK_WINDOW_TYPE_HINT_NORMAL, skip-taskbar-hint=FALSE, skip-pager-hint=FALSE, urgency-hint=FALSE, accept-focus=TRUE, focus-on-map=TRUE, decorated=TRUE, deletable=TRUE, gravity=GDK_GRAVITY_NORTH_WEST, transient-for, attached-to, has-resize-grip, resize-grip-visible, application, is-active=FALSE, has-toplevel-focus=FALSE, startup-id, mnemonics-visible=FALSE, focus-visible=FALSE, is-maximized=FALSE)
julia> signal_connect(win, :destroy, false) do w # false here is the `after` arg
Gtk.gtk_quit() # this calls gtk_main_quit
end
0x0000000000000080
Then try to close the window and it will hang, but running this will immediately finish the close:
julia> Gtk.gtk_main()
Current behavior
On Linux and Windows the window closes as expected. On MacOS the window stays open, frozen. This is both when the signal is set to after = 0 and 1
Calling gtk_main after this makes the window continue and close properly. It really seems like the main loop just hasn't finished closing the window when the signal callback is triggered.
Expected outcome
The window finishes closing even though gtk_main_quit has been called
Version information
GTK3_jll v3.24.31 https://github.com/JuliaPackaging/Yggdrasil/tree/master/G/GTK3
Glib_jll v2.68.3 https://github.com/JuliaPackaging/Yggdrasil/tree/master/G/Glib
MacOS 12.1
Additional information
I've not been able to test other MacOS versions.