Race condition during Dispatcher deconstruction



Hi,

I've been observing a crash which shortly follows the deletion of a
Glib::Dispatcher object. The scenario goes something like this:

* Dispatcher instance is allowed by mainloop thread
* Some UI widget registers a callback on the dispatcher
* Background thread does an emit()
* UI thread deletes the widget, including reclaiming the dispatcher
* When the mainloop becomes idle again, the GIOSource listening for
the receiver side of the dispatcher wakes up and tries to deliver the
signal to the now-reclaimed dispatcher

Specifically, I get a crash in the Dispatcher::pipe_io_handler
function during a GIOSource [presumably, the one registered by the
receiver side of the Dispatcher] callback execution.

Does this sound plausible? If so, is there a known safe pattern to
avoid this race?


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