GNOME Bugzilla – Bug 673282
girepository: g_object_info_get_*_function_pointer() is completely broken
Last modified: 2015-02-07 17:02:55 UTC
g_object_info_get_*_function() family of functions is completely broken because of bugs in underlying _get_func() implementation. See attached patch with description and fix.
Created attachment 211064 [details] [review] Avoid _get_func() consuming reference from input info Fix of leak in 4c9424e18d71237f438a99bc5f2d45ae7de60b78 was a bit overaggressive, stealing also one reference from input 'info' argument. Also fixes another bug in that commit - local 'func' shadowing the return value, causing that function always returned NULL even when some result was actually found.
Review of attachment 211064 [details] [review]: This would be far easier to review if there were a test case included. Is it possible to write one?
Probably yes, but I don't think that it would be informative for the review. The testcase is: GIBaseInfo *info; info = g_irepository_find_by_name(NULL, "Regress", "TestFundamentalObject"); gpointer func = g_object_info_get_ref_function_pointer (info); assert (info != NULL); g_base_info_unref (info); 1. failing at assert() 2. even if assert is commented out, crashing later in g_base_info_unref(), because g_object_info_get_ref_function_pointer() already stole the last reference from the info. I'm a bit out of time now, I can try to add proper patch with integrated testcase during the weekend, if needed.
(In reply to comment #3) > GIBaseInfo *info; > info = g_irepository_find_by_name(NULL, "Regress", "TestFundamentalObject"); > gpointer func = g_object_info_get_ref_function_pointer (info); > assert (info != NULL); > g_base_info_unref (info); oops, mistake; assert (func != NULL);
Created attachment 211544 [details] [review] Avoid _get_func() consuming reference from input info Another version of the patch, contains simple test which crashes when the fix is not applied.
Review of attachment 211544 [details] [review]: Perfect, thanks.
I suggest to include this patch also to 3_4 branch, this bug is regression from GI 1.30 Attachment 211544 [details] pushed as 5fda6c3 - Avoid _get_func() consuming reference from input info
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]