GNOME Bugzilla – Bug 639952
GLib.Variant.new_variant() created objects cause segfaults with each operation
Last modified: 2011-04-15 14:04:04 UTC
Created attachment 178728 [details] stack trace I can create a variant containing a variant just fine, but trying to call any method on it just segfaults: $ gdb --args python -c 'from gi.repository import GLib; v=GLib.Variant.new_variant(GLib.Variant.new_int32(-42)); print v.get_type_string()' [...] Program received signal SIGSEGV, Segmentation fault. 0x00007ffff58d72f4 in g_variant_type_info_check (info=0x0, container_class=0 '\000') at gvarianttypeinfo.c:164 164 g_assert (info->alignment == 0 || info->alignment == 1 ||
+ Trace 225587
As the full stack trace is quite large, I'll attach it. This is with glib, pygobject, and gobject-introspection git master as of today.
Interestingly it does work with the variant builder: $ python >>> from gi.repository import GLib >>> i = GLib.Variant.new_int32(-42) >>> builder = GLib.VariantBuilder() >>> import gi >>> builder.init(gi._gi.variant_type_from_string('v')) >>> builder.add_value(i) >>> v=builder.end() >>> v <GLib.Variant(<-42>)> >>> v.get_type_string() 'v' >>> v.get_variant() <GLib.Variant(-42)>
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.