ref_count problems with gtk.Toolbars

17 views
Skip to first unread message

Robert Schroll

unread,
Feb 14, 2011, 10:55:45 PM2/14/11
to reint...@googlegroups.com
Hi all,

Here's a weird problem I've run across, and I was wondering if other
people see it. A widget embedded in a worksheet that includes a
gtk.Toolbar will often prints "Warning: g_object_ref: assertion
`object->ref_count > 0' failed" when the widget is unrealized. I've
included a simple test case below. For the test case, reasonable code
lines are cited (gtk.TextBuffer.do_delete_range(self, start, end) when
the widget is being moved relative to text; self.window.destroy() when
the notebook is closed). But in more complicated examples, it cites
apparently random lines of code, so I don't know if we can trust this in
either case. More complicated cases will give "GLib-GObject-CRITICAL
**: g_object_ref: assertion `object->ref_count > 0' failed" when
quitting Reinteract; this testcase only reprints the warning at this point.

I'm guessing this is because something (perhaps a gdk.Window?) is not
being properly destroyed, but I have no idea of how to figure out what
that thing is. Any help? If it matters, I'm using libgtk
2.20.1-0ubuntu2, pygtk 2.17.0-0ubuntu2, and the current git version of
Reinteract.

Thanks,
Robert

----Test case----
import gtk
from reinteract.custom_result import CustomResult

class Toolbar(CustomResult):

def create_widget(self):
return gtk.Toolbar()

Toolbar()
----Test case----
1) Copy this into a worksheet

2) Execute it

3) Edit the last line, and re-execute
- I get in the terminal:
/home/rschroll/reinteract/lib/reinteract/shell_buffer.py:343: Warning:
g_object_ref: assertion `object->ref_count > 0' failed
gtk.TextBuffer.do_delete_range(self, start, end)

4) Close the notebook
- I get:
/home/rschroll/reinteract/lib/reinteract/base_window.py:113: Warning:
g_object_ref: assertion `object->ref_count > 0' failed
self.window.destroy()

daspostloch

unread,
Feb 15, 2011, 5:34:13 AM2/15/11
to reint...@googlegroups.com
confirming for

Reinteract v0.4.9-49-geb23954
pygtk 2.22.0-3
gtk2 2.22.0-2

on arch linux, but no idea on the subject.

i merely noted that
** the first error only works once
** the second does not show up when closing
reinteract entirely, just that sheet.

in general, i sometimes do get assertions raised
when working - would you prefer i reported them
every time?

--
"It's zero-zum. Who's on the other side? Who's the idiot?"
"D�sseldorf. Stupid Germans. They take rating agencies serious. They
believe in the rules."

Robert Schroll

unread,
Feb 15, 2011, 3:36:01 PM2/15/11
to reint...@googlegroups.com
On 02/15/2011 05:34 AM, daspostloch wrote:
> confirming for
>
> Reinteract v0.4.9-49-geb23954
> pygtk 2.22.0-3
> gtk2 2.22.0-2
>
> on arch linux, but no idea on the subject.

Thanks. At least I know it's not just me.


>
> i merely noted that
> ** the first error only works once

That's what I see here. But for more complex Toolbars, I may see this
error reported sporadically.

> ** the second does not show up when closing
> reinteract entirely, just that sheet.

Yes, you're right about that. I thought I had tested closing the sheet,
and hadn't gotten the error. But I'm getting it now.

I forgot to mention that I'm pretty sure it's the unrealize event that's
doing this, not the delete event, because it can also be caused by running:
>>> if True:
... Toolbar()
>>> 1
and then indenting the last line. This will move the last line to
before the Toolbar widget, which is actually accomplished by moving the
widget relative to the text. This involves an unrealize/realize
sequence which can (though doesn't always) trigger this warning.


>
> in general, i sometimes do get assertions raised
> when working - would you prefer i reported them
> every time?
>

If you can reliably (or semi-reliably) raise assertions, you might as
well report them.

Thanks for the confirmation,
Robert

Robert Schroll

unread,
Feb 16, 2011, 11:30:04 PM2/16/11
to reint...@googlegroups.com
A bug report on this issue:
https://bugzilla.gnome.org/show_bug.cgi?id=642527

Robert

Reply all
Reply to author
Forward
0 new messages