Glib::signal_idle().connect() not thread-safe
Submitted by Daniel Elstner
Link to original bug (#396958)
Description
Connecting to Glib::signal_idle() or one of the other special signal sources in glibmm (timeout, io, etc) is not thread-safe, as memory visibility rules aren't observed.
Details as discussed on the gtkmm mailing list:
Now to the bad news. Glib::signal_idle().connect() returns a sigc::connection object.
connection::connection(slot_base& sl) : slot_(&sl) { slot_->add_destroy_notify_callback(this, ¬ify); }
connection::~connection() { if (slot_) slot_->remove_destroy_notify_callback(this); }
Doomed, I'd say. At least the call to remove_destroy_notify_callback() after the GSource mutex has been unlocked is unavoidable with the current API. Maybe we'll be able to play some tricks and put something entirely different into the sigc::connection object. A special-purpose slot which holds a connection ID or something, and goes through the GMainLoop/GSource interface to destroy the callback slot.
Version: 2.13.x