GNOME Bugzilla – Bug 706983
Unref unused class
Last modified: 2018-05-24 15:38:49 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.
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.
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 on attachment 253389 [details] [review] unref unused class Thank you for the review. I've committed your version of the patch.
I'll prepare the testcase later (next week probably).
-- 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.