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 706983 - Unref unused class
Unref unused class
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gobject
2.36.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-08-28 14:26 UTC by Marek Kašík
Modified: 2018-05-24 15:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
unref unused class (911 bytes, patch)
2013-08-28 14:26 UTC, Marek Kašík
committed Details | Review
reproducer (1020 bytes, application/x-bzip)
2013-08-28 14:30 UTC, Marek Kašík
  Details

Description Marek Kašík 2013-08-28 14:26:47 UTC
Created attachment 253389 [details] [review]
unref unused class

Function "object_interface_check_properties()" returns without proper unref of a class structure which it refs at its beginning. This happens if given class type is not child of GObjectClass and implements an interface.

Attached patch fixes this.
Comment 1 Marek Kašík 2013-08-28 14:30:25 UTC
Created attachment 253392 [details]
reproducer

This is a reproducer of the problem. I use the "glib-reproducer.patch" to make "g_type_class_peek()" to show me refcount of given class type.
Executing the reproducer should show the same refcount twice.
Comment 2 Matthias Clasen 2014-05-21 13:16:14 UTC
Review of attachment 253389 [details] [review]:

For extra credit, come up with a testcase that demonstrates the leak

::: gobject/gobject.c
@@ +1392,3 @@
+
+      return;
+    }

Looks correct - catches a real corner case, but ok. I'd write this as

if (class == NULL)
  return;

if (!G_IS_OBJECT_CLASS (class))
  goto out;

but this is fine too
Comment 3 Marek Kašík 2014-05-22 09:02:16 UTC
Comment on attachment 253389 [details] [review]
unref unused class

Thank you for the review. I've committed your version of the patch.
Comment 4 Marek Kašík 2014-05-22 09:03:06 UTC
I'll prepare the testcase later (next week probably).
Comment 5 GNOME Infrastructure Team 2018-05-24 15:38:49 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/750.