GNOME Bugzilla – Bug 587300
Deadlock when calling g_cancellable_disconnect in a "cancelled" callback
Last modified: 2009-11-12 04:56:00 UTC
You get a dead lock if you call g_cancellable_disconnect in the "cancelled" callback of this cancellable. g_cancellable_cancel sets priv->cancelled_running to FALSE after having fired the "cancelled" signal. So, if you call g_cancellable_disconnect in the callback, it will wait for priv->cancelled_running becoming FALSE forever. Am I doing something wrong here (in which case that should be documented)?
This is the correct behaviour. The entire point of g_cancellable_disconnect() is that it blocks until no more signal handlers are running. By definition it will block when you call it from the signal handler. I just commited a patch to make this clear in the documentation for the function.