GNOME Bugzilla – Bug 670926
CellRenderSpin: Warning: g_object_notify: assertion `G_IS_OBJECT (object)' failed
Last modified: 2013-09-11 10:23:42 UTC
Using the following code for a Gtk.CellRenderSpin results in the following error after changing the spin button several times. The error is: /usr/lib/python2.7/dist-packages/gi/types.py:43: Warning: g_object_notify: assertion `G_IS_OBJECT (object)' failed return info.invoke(*args, **kwargs) Segmentation fault #! /usr/bin/env python # -*- coding: utf-8 -*- from gi.repository import Gtk class CellRendererSpinWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="CellRendererSpin Example") self.set_default_size(200, 200) self.liststore = Gtk.ListStore(str, int) self.liststore.append(["Oranges", 5]) self.liststore.append(["Apples", 4]) self.liststore.append(["Bananas", 2]) treeview = Gtk.TreeView(model=self.liststore) renderer_text = Gtk.CellRendererText() column_text = Gtk.TreeViewColumn("Fruit", renderer_text, text=0) treeview.append_column(column_text) renderer_spin = Gtk.CellRendererSpin() renderer_spin.connect("edited", self.on_amount_edited) renderer_spin.set_property("editable", True) adjustment = Gtk.Adjustment(0, 0, 100, 1, 10, 0) renderer_spin.set_property("adjustment", adjustment) column_spin = Gtk.TreeViewColumn("Amount", renderer_spin, text=1) treeview.append_column(column_spin) self.add(treeview) def on_amount_edited(self, widget, path, value): self.liststore[path][1] = int(value) win = CellRendererSpinWindow() win.connect("delete-event", Gtk.main_quit) win.show_all() Gtk.main() This code comes from http://python-gtk-3-tutorial.readthedocs.org/en/latest/cellrenderers.html It is confirmed by another user via Ubuntu launchpad at https://bugs.launchpad.net/ubuntu/+source/pygobject/+bug/908889 My system is a Debian system tracking debian testing. Exact python --version is Python 2.7.2+
With current pygobject 3.2 and GTK 3.4.1 I don't get a segfault any more, just an occasional warning. I'm not sure whether this is a bug in pygobject or in Gtk, though.
Lots of fixes have gone into PyGObject in regards to GObject reference counting. I no longer see the segfault or any warnings, please re-open if this can be reproduced another way.
I have GTK ver 3.4.2, python-gobject 3.2.2, and python Python 2.7.3rc2. After I spin one button, then move down to spin the next one (or make the first one loose focus and reselect it), I will get the warning. Still functions. Doesn't break. Just still getting the error message. Better than a segfault. My system is Debian tracking testing. Here is the warning message: " /usr/lib/python2.7/dist-packages/gi/types.py:43: Warning: g_object_notify: assertion `G_IS_OBJECT (object)' failed return info.invoke(*args, **kwargs) " Still, I'm pleased no more segfault, so it is good progress. For good measure, I tested it under Python 3.2.3 and it gives a warning, but no segfault. Similar message (except for, of course, against a different library): " /usr/lib/python3/dist-packages/gi/types.py:43: Warning: g_object_notify: assertion `G_IS_OBJECT (object)' failed return info.invoke(*args, **kwargs) "
Thanks, I can reproduce this with Python 2.7.3, GTK 3.6.2, and PyGObject 3.4.0 but not with the latest repository code (GTK 3.8 and PyGObject 3.8). However, I did run into another similar issue: 1. click to edit spinner item 2. immediately click window title 3. click to edit the same spinner item Gtk-CRITICAL **: gtk_spin_button_get_adjustment: assertion `GTK_IS_SPIN_BUTTON (spin_button)' failed
The bug described here has been fixed since 3.8 and the assertion mentioned in comment #4 is no longer reproducible with the latest GTK+ and PyGObject sources.