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 737338 - gmain: Unref child sources when finalising a GSource
gmain: Unref child sources when finalising a GSource
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: mainloop
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-09-25 08:52 UTC by Philip Withnall
Modified: 2014-09-25 13:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gmain: Fix some signed/unsigned integer comparisons (972 bytes, patch)
2014-09-25 08:52 UTC, Philip Withnall
committed Details | Review
gmain: Unref child sources when finalising a GSource (1.29 KB, patch)
2014-09-25 08:52 UTC, Philip Withnall
committed Details | Review

Description Philip Withnall 2014-09-25 08:52:49 UTC
Patches attached.
Comment 1 Philip Withnall 2014-09-25 08:52:51 UTC
Created attachment 287049 [details] [review]
gmain: Fix some signed/unsigned integer comparisons

Just to shut gcc up.
Comment 2 Philip Withnall 2014-09-25 08:52:55 UTC
Created attachment 287050 [details] [review]
gmain: Unref child sources when finalising a GSource

If a GSource is created, *not* attached to a GMainContext, and then has
child sources added, dropping the last reference to the parent GSource
will leak its references to its child sources. Currently, child sources
are only unreffed when g_source_destroy() is called on the parent.
Comment 3 Dan Winship 2014-09-25 12:36:21 UTC
Comment on attachment 287050 [details] [review]
gmain: Unref child sources when finalising a GSource

ok, but:

>+      while (source->priv->child_sources) {
>+        GSource *child_source = source->priv->child_sources->data;

fix the indent style. ("{" should go on the next line)
Comment 4 Philip Withnall 2014-09-25 13:00:10 UTC
Pushed with the style fix (whoops, sorry).

Attachment 287049 [details] pushed as eaca868 - gmain: Fix some signed/unsigned integer comparisons
Attachment 287050 [details] pushed as 1c6df7a - gmain: Unref child sources when finalising a GSource