Thread safety clarifications?
Blog post: https://blogs.gnome.org/chergert/2018/03/21/gtask-and-threaded-workers/
Here's what I usually do when I need a worker thread for a widget: send self._callback
to the worker thread and use GLib.idle_add(callback, event)
to communicate with the widget. However, the blog post suggest that it's not safe to even store a reference to a widget in another thread because disposing widgets from another thread is not supported.
I haven't been able to find anything about this in the official documentation: https://pygobject.readthedocs.io/en/latest/guide/threading.html
Edited by Nikita Churaev