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 701283 - g_source_add_child_source() segfault
g_source_add_child_source() segfault
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: mainloop
2.37.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
: 710394 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-05-30 14:52 UTC by Wim Taymans
Modified: 2013-10-17 14:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
possible patch (2.70 KB, patch)
2013-05-30 14:52 UTC, Wim Taymans
committed Details | Review

Description Wim Taymans 2013-05-30 14:52:35 UTC
Created attachment 245651 [details] [review]
possible patch

in g_source_add_child_source() we assert that the child_source has no context. If the source is blocked, we try to block the new child source as well (before attaching it to the context). in block_source we call g_main_context_remove_poll_unlocked() with the child_source context (which is NULL) and we get a segfault.

I believe two things need to be done:

1) when blocking a source without a context, don't call g_main_context_remove_poll_unlocked() with the NULL context. 

2) when calling g_source_attach with a blocked source, don't call 
g_main_context_add_poll_unlocked() this is similar to how g_source_add_poll() and others deals with blocked sources.
Comment 1 Matthias Clasen 2013-05-31 10:24:15 UTC
Dan,  I think child sources were your invention ?
Comment 2 Dan Winship 2013-05-31 15:41:22 UTC
Comment on attachment 245651 [details] [review]
possible patch

yes, sounds right
Comment 3 Wim Taymans 2013-06-21 08:58:12 UTC
Please commit for me, I don't have that power..
Comment 4 Dan Winship 2013-06-25 13:36:19 UTC
pushed, along with a test case
Comment 5 Dan Winship 2013-10-17 14:36:20 UTC
*** Bug 710394 has been marked as a duplicate of this bug. ***