After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 587300 - Deadlock when calling g_cancellable_disconnect in a "cancelled" callback
Deadlock when calling g_cancellable_disconnect in a "cancelled" callback
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.21.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2009-06-29 12:27 UTC by Guillaume Desmottes
Modified: 2009-11-12 04:56 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Guillaume Desmottes 2009-06-29 12:27: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)?
Comment 1 Allison Karlitskaya (desrt) 2009-11-12 04:56:00 UTC
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.