Re: display stopped by another program



There is a chapter on multi-threaded programs in the gtkmm tutorial.

https://developer.gnome.org/gtkmm-tutorial/stable/chapter-multi-threaded-programs.html.en

It's said there that glib is thread-safe. What is perhaps not stressed enough is that gtk+ is not thread-safe. As Daniel has said, it's essential that everything that affects the GUI shall be done in the GUI thread, the thread that's started "for free", without using std::thread.


Den 2018-01-18 kl. 20:00, skrev Alex Ormond:

Daniel,

I've designed things this way because I can't have an "interruptible loop" using Gtk.  After much effort this was the only way I ever found to do it.

However, what you said gives me an idea!  I'm currently creating the Pixbuf, whose data I'm manipulating, in the thread.  I'll instead try creating it in the UI and making it global, and see if that makes a difference.

Many Thanks,

Alex



On 01/18/2018 01:45 PM, Daniel Boles wrote:
The general rule is that only the thread in which GLib/GTK+/etc. was initialised should ever do anything with widgets or other non-trivial objects. If you're doing that, all bets are off. But it's not really clear whether you are.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]