I’m getting this exception when calling GAccessor.text(buffer, "", -1)
while handling an file-activated
signal. I’ve spent the last 2 hours trying to recreate it with a single example, and so far I cannot reproduce it.
Not sure if anyone has a suggestions, but I would really like some idea of what would cause a task switch in this case.
Basically I’m handling the file-activated
from a choose file dialog box, and my code does:
@info "At Start - Stack: $(Gtk.GLib.g_stack) Current: $(current_task())"
hide(dialog)
@info "At Call - Stack: $(Gtk.GLib.g_stack) Current: $(current_task())"
GAccessor.text(buffer, "", -1)
@sigatom @async begin
@info "At Inside - Stack: $(Gtk.GLib.g_stack) Current: $(current_task())"
# Do something that takes a few seconds
@sigatom begin
GAccessor.text(buffer, result, -1)
end
end
The output ends up:
[ Info: At Start - Stack: Task (runnable) @0x00007fc22600b820 Current: Task (runnable) @0x00007fc22600b820
[ Info: At Call - Stack: Task (runnable) @0x00007fc22600b820 Current: Task (runnable) @0x00007fc22600b820
┌ Error: Exception AssertionError("xor(prev, current_task() !== g_stack)")
└ @ Ui ~/.julia/packages/Ui/xc1es/src/gtk/module.jl:97
┌ Warning: AssertionError: xor(prev, current_task() !== g_stack)
│
│ g_siginterruptible(::getfield(Gtk.GLib, Symbol("##89#91")){Ptr{Gtk.GLib.GValue},UInt32,Ptr{Gtk.GLib.GValue},Ptr{Any},getfield(Ui, Symbol("##17#19")),Bool,Array{Any,1}}, ::Function) at signals.jl:200
│ GClosureMarshal(::Ptr{Nothing}, ::Ptr{Gtk.GLib.GValue}, ::UInt32, ::Ptr{Gtk.GLib.GValue}, ::Ptr{Nothing}, ::Ptr{Nothing}) at signals.jl:59
│ text(::GtkTextBufferLeaf, ::String, ::Int64) at gbox3:4538
I can work around the issue by prefixing the GAccessor.text(buffer, "", -1)
call with @sigatom
but I would really like to know why there is an issue. I’ve even tried adding a sleep after the text
line to see if it was some sort of scheduling issue, but the problem still happens.
And it only happens the second time I perform the operation, IF the buffer contains existing data. If the buffer is empty because of first use or because I manually delete it, everything is fine…