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 754359 - Creation of GValue containing GObject.ValueArray segfaults
Creation of GValue containing GObject.ValueArray segfaults
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: general
Git master
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2015-08-31 14:08 UTC by Mikhail Fludkov
Modified: 2016-02-21 05:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdb stacktrace (2.65 KB, text/plain)
2015-08-31 14:08 UTC, Mikhail Fludkov
  Details
pygi-value: special case for NULL GValueArray (1.98 KB, patch)
2015-09-01 16:26 UTC, Mikhail Fludkov
committed Details | Review

Description Mikhail Fludkov 2015-08-31 14:08:25 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)
Comment 1 Mikhail Fludkov 2015-08-31 14:29:43 UTC
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.
Comment 2 Mikhail Fludkov 2015-09-01 16:26:38 UTC
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.
Comment 3 Mikhail Fludkov 2016-01-19 09:29:25 UTC
Did somebody had a chance to have look at this issue?
Comment 4 Simon Feltman 2016-01-19 17:53:43 UTC
Review of attachment 310436 [details] [review]:

Looks good to me. Thanks for the patch and sorry it took so long.
Comment 5 Mikhail Fludkov 2016-01-19 22:21:55 UTC
Great, no problem.