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()
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."
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