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 688249 - Accessing style context directly from constructor results in a segmentation fault
Accessing style context directly from constructor results in a segmentation f...
Status: RESOLVED DUPLICATE of bug 678607
Product: pygobject
Classification: Bindings
Component: general
3.4.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-11-13 13:42 UTC by Izidor Matušov
Modified: 2012-11-19 06:51 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Izidor Matušov 2012-11-13 13:42:00 UTC
When I run the following code, I get segmentation fault.

<code>
>>> from gi.repository import Gtk
>>> Gtk.TreeView().get_style_context().get_color(Gtk.StateFlags.INSENSITIVE)

(.:11732): Gtk-CRITICAL **: gtk_style_context_get_property: assertion `priv->widget != NULL || priv->widget_path != NULL' failed
/usr/lib/python3/dist-packages/gi/types.py:47: Warning: /build/buildd/glib2.0-2.34.0/./gobject/gtype.c:4204: type id `0' is invalid
  return info.invoke(*args, **kwargs)
/usr/lib/python3/dist-packages/gi/types.py:47: Warning: can't peek value table for type `<invalid>' which is not currently referenced
  return info.invoke(*args, **kwargs)
Segmentation fault
</code>

As I found out on #python channel that I should split the constructor and getter in the following way:

<code>
>>> from gi.repository import Gtk
>>> tv = Gtk.TreeView()
>>> tv.get_style_context().get_color(Gtk.StateFlags.INSENSITIVE)
<Gdk.Color(red=0.585613, green=0.567059, blue=0.548504, alpha=1.000000)>
</code>

It would be nicer to raise a python exception instead of a segfault.
Comment 1 Martin Pitt 2012-11-19 06:51:54 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 678607 ***