GNOME Bugzilla – Bug 768413
function: Release out args before freeing caller allocated structs
Last modified: 2016-07-05 07:54:35 UTC
See patch. This fixes a crash with the following test program for me: const Gtk = imports.gi.Gtk; Gtk.init(null, null); let w = new Gtk.Label(); let context = w.get_style_context(); context.add_class('dim-label') log(context.get_property('opacity', context.get_state()));
Created attachment 330869 [details] [review] function: Release out args before freeing caller allocated structs If an out arg is caller allocated, we need to free the memory we allocated for it (for instance a GValue), but also release any memory allocated for struct members (for instance a string held by a GValue). We currently do these operations in this order, so the pointer used for releasing the argument points to memory invalidated by the earlier free call, which is likely to crash. To fix, reverse the order of the operations to first release the argument and then free the caller-allocated struct.
Review of attachment 330869 [details] [review]: Makes sense to me.
Attachment 330869 [details] pushed as eb13ed4 - function: Release out args before freeing caller allocated structs