Closed phil294 closed 1 year ago
All UI rendering in GTK must happen in the same thread of the main loop, you can do stuff in other threads... but need to update the UI always in the same mainloop thread.
So usually you do stuff in some thread and update the UI in the callback of GLib.idle_add
.
oh my, you're right. Thanks @hugopl, and sorry about that.
I thought I had trimmed down some errors I was seeing to the smallest possible reproduction case, but I forgot to use idle_add
along the way, so this issue is nonsense.
Sorry for all these issues... but I think this one is quite different from my previous one, as it has nothing to do with GC:
run with MT, and GC disabled to make sure these aren't gc problems:
This usually runs fine for a few iterations (something between 0 and 200 times). Alongside it may output Gtk-Warnings. Eventually it crashes, for example like this:
Now obviously,
preview_mt
implies that multi-threading is an experimental feature, so I shouldn't get my hopes up high. However, crystal-gobject + preview_mt DO work great together, most of the time! It's just that when you run a lot of code with it, at some point things will fail.So I wanted to share this experience, hoping that someone has an idea. :-)