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 670926 - CellRenderSpin: Warning: g_object_notify: assertion `G_IS_OBJECT (object)' failed
CellRenderSpin: Warning: g_object_notify: assertion `G_IS_OBJECT (object)' fa...
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
3.2.x
Other Linux
: Normal minor
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-02-28 00:23 UTC by narnie
Modified: 2013-09-11 10:23 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description narnie 2012-02-28 00:23:50 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+
Comment 1 Martin Pitt 2012-04-22 08:15:45 UTC
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.
Comment 2 Simon Feltman 2013-04-14 11:45:49 UTC
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.
Comment 3 narnie 2013-04-14 20:52:22 UTC
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)
"
Comment 4 Simon Feltman 2013-04-14 22:03:12 UTC
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
Comment 5 Simon Feltman 2013-09-11 10:23:42 UTC
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.