GNOME Bugzilla – Bug 754359
Creation of GValue containing GObject.ValueArray segfaults
Last modified: 2016-02-21 05:23:53 UTC
Created attachment 310364 [details] gdb stacktrace The following code segfaults in pygi_value_to_py_structured_type at pygobject/gi/pygi-value.c:777 > from gi.repository import GObject > GObject.Value(GObject.ValueArray)
I found the issue while porting our python code to use pygobject instead of static bindings from gst-python. I want to create a GValue with an array of GstStructures. Or just something similar to GValueArray. The problem is to choose correct type for the array. > GObject.Value(Gst.ValueArray) Throws exceptions.TypeError: unknown type GstValueArray > GObject.Value(GObject.ValueArray) segfaults > GObject.Value(GLib.Array) Creates an GArray without setting the clear function thus introducing memory leak I posted the question at #python IRC channel and was suggested to create the bug report regarding the segfault. I'm also wondering if the exception in the first example is expected behavior or I should create a separate bug report about it? And is there a way to create GArray from python with clear function properly set? I will really appreciate any help in finding a workaround for my problem.
Created attachment 310436 [details] [review] pygi-value: special case for NULL GValueArray I think I fixed the problem. I'm attaching the patch for review.
Did somebody had a chance to have look at this issue?
Review of attachment 310436 [details] [review]: Looks good to me. Thanks for the patch and sorry it took so long.
Great, no problem.
Review of attachment 310436 [details] [review]: committed: https://git.gnome.org/browse/pygobject/commit/?id=f27b1976ea3