-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Hello,
I've managed to produce another crash and find a MWE for it.
The MWE tracks some state in a struct and can (re-)generate a GtkNotebook
from its current state. When you press the button, I throw away the existing notebook and generate a new one.
Pressing the button repeatedly and/or manually invoking GC.gc()
after a crashes Gtk4.
Here is the MWE:
using Gtk4
mutable struct MyPage
page::Int64
values::Vector{String}
MyPage(values) = new(1, values)
end
function mywidget(page::MyPage)
nb = GtkNotebook()
# Pages
for (i, value) in enumerate(page.values)
entry = GtkEntry()
entry.text = value
signal_connect(entry, :activate) do w
page.values[i] = entry.text
end
push!(nb, entry, "$i")
end
# Page Change
nb.page = page.page - 1
signal_connect(nb, :switch_page) do _, _, idx
page.page = idx + 1
end
return nb
end
page = MyPage(["This", "is", "a", "test"])
window = GtkWindow()
box = GtkBox(:v)
push!(window, box)
btn = GtkButton("Click me!")
push!(box, btn)
container = GtkBox(:h)
push!(box, container)
signal_connect(btn, :clicked) do w
@idle_add begin
empty!(container)
push!(container, mywidget(page))
end
end
show(window)
First I get an error with:
┌ Warning: Executing #2:
└ @ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\signals.jl:122
xor(prev, current_task() !== g_stack)
Stacktrace:
[1] g_siginterruptible(f::Gtk4.GLib.var"#142#144"{Ptr{Gtk4.GLib.GValue}, UInt32, Ptr{Gtk4.GLib.GValue}, Vector{Any}, var"#2#4"{MyPage}}, cb::Any)
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\signals.jl:237
[2] GClosureMarshal(closuref::Ptr{Nothing}, return_value::Ptr{Gtk4.GLib.GValue}, n_param_values::UInt32, param_values::Ptr{Gtk4.GLib.GValue}, invocation_hint::Ptr{Nothing}, marshal_data::Ptr{Nothing})
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\signals.jl:57
[3] glib_unref
@ C:\Users\...\.julia\dev\Gtk4\src\GLib\gtype.jl:288 [inlined]
[4] gc_unref
@ C:\Users\...\.julia\dev\Gtk4\src\GLib\gtype.jl:280 [inlined]
[5] finalize_gc_unref(x::Gtk4.GLib.GObject)
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\gtype.jl:312
[6] macro expansion
@ C:\Users\...\.julia\dev\Gtk4\src\GLib\gtype.jl:387 [inlined]
[7] macro expansion
@ .\lock.jl:273 [inlined]
[8] run_delayed_finalizers()
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\gtype.jl:384
[9] gobject_ref(x::GtkNotebookLeaf)
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\gtype.jl:369
[10] convert_(::Type{Gtk4.GLib.GObject}, ptr::Ptr{Gtk4.GLib.GObject}, owns::Bool)
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\gtype.jl:194
[11] convert (repeats 2 times)
@ C:\Users\...\.julia\dev\Gtk4\src\GLib\gtype.jl:183 [inlined]
[12] #78
@ C:\Users\...\.julia\dev\Gtk4\src\GLib\gvalues.jl:187 [inlined]
[13] getindex(gv::Base.RefValue{Gtk4.GLib.GValue}, ::Type{Any})
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\gvalues.jl:248
[14] (::Gtk4.GLib.var"#142#144"{Ptr{Gtk4.GLib.GValue}, UInt32, Ptr{Gtk4.GLib.GValue}, Vector{Any}, var"#2#4"{MyPage}})()
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\signals.jl:60
[15] g_siginterruptible(f::Gtk4.GLib.var"#142#144"{Ptr{Gtk4.GLib.GValue}, UInt32, Ptr{Gtk4.GLib.GValue}, Vector{Any}, var"#2#4"{MyPage}}, cb::Any)
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\signals.jl:244
[16] GClosureMarshal(closuref::Ptr{Nothing}, return_value::Ptr{Gtk4.GLib.GValue}, n_param_values::UInt32, param_values::Ptr{Gtk4.GLib.GValue}, invocation_hint::Ptr{Nothing}, marshal_data::Ptr{Nothing})
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\signals.jl:57
[17] glib_unref
@ C:\Users\...\.julia\dev\Gtk4\src\GLib\gtype.jl:288 [inlined]
[18] gc_unref
@ C:\Users\...\.julia\dev\Gtk4\src\GLib\gtype.jl:280 [inlined]
[19] finalize_gc_unref(x::Gtk4.GLib.GObject)
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\gtype.jl:312
[20] macro expansion
@ C:\Users\...\.julia\dev\Gtk4\src\GLib\gtype.jl:387 [inlined]
[21] macro expansion
@ .\lock.jl:273 [inlined]
[22] run_delayed_finalizers()
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\gtype.jl:384
[23] g_yield(data::UInt64)
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\signals.jl:267
[24] uv_dispatch(src::Ptr{Nothing}, callback::Ptr{Nothing}, data::Int64)
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\signals.jl:363
[25] (::Gtk4.GLib.var"#237#238")()
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\loop.jl:83
[26] g_sigatom(f::Any)
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\signals.jl:211
[27] glib_main()
@ Gtk4.GLib C:\Users\...\.julia\dev\Gtk4\src\GLib\loop.jl:80
here a lot of stacktraces are interwoven probably due to me spamming the button (edited: Managed to get a clean stacktrace)
Then after a while I get:
Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x67f1fd48 -- signal_emit_unlocked_R at C:\Users\...\.julia\artifacts\7de578e660d4ad9f8ddbe10244cc8730d674b85c\bin\libgobject-2.0-0.dll (unknown line)
in expression starting at none:0
signal_emit_unlocked_R at C:\Users\...\.julia\artifacts\7de578e660d4ad9f8ddbe10244cc8730d674b85c\bin\libgobject-2.0-0.dll (unknown line)
signal_emit_valist_unlocked at C:\Users\...\.julia\artifacts\7de578e660d4ad9f8ddbe10244cc8730d674b85c\bin\libgobject-2.0-0.dll (unknown line)
Some context for this setting: I have a GtkListBox which I fill various widgets. On certain actions by the user, I have to exchange certain entries in the listbox. However, the only way I managed to get that work at the moment is to completely repopulate the box. For that I track my application state not directly in GtkWidgets, but instead in a struct which then can produce a widget. One of those widgets was a notebook and after repopulation garbage collection crashes the app.