Re: GTK warning



hi,

Jeffrey Barish schrieb:
Dov Grobgeld wrote:
2009/2/21 Jeffrey Barish <jeff_barish earthlink net>

I hate the warning messages that GTK provides because they rarely help me
find the problem.  What does this one mean?

/myprogram.py:118: Warning: g_object_unref: assertion `object->ref_count
0' failed
 self['myimage'].set_from_pixbuf(mypb)

What object is producing the warning?  I suppose it must be myimage. 
What am I supposed to do?  If I exit the program and run it again, 9
times out of 10 I don't get the warning.
The message means exactly what it sais, that you try to reduce the ref
count of an object that doesn't exist.

Of course.  My complaint is that the message doesn't tell me which object. 
It refers me to a specific line in which it isn't obvious that any object
is being unreferenced.  That line sets the pixbuf, which, if anything,
would increase the ref count of something.  If the dereference occurs
somewhere else, then the warning shouldn't refer me to this line of code.

How should gobject know the name of your variable? In GStreamer we have a
GstObejct which has a name property, that makes it easier.

But since the example you give is in Python this probably means that there
is an error in the python binding. You should try to create a minimum
example that triggers the problem and try to create a bug report.

If there were an error in the Python binding, then I would expect the
warning to be consistent.  For that matter, it should be consistent if the
error were in my code or in GTK.

I'm running my program with --g-fatal-warnings at the end of the command
line.  I don't know whether that flag does anything in PyGTK, though.

That flag work on Glib level and makes warnings fatal to be able to get a
backtrace in gdb. For refcounts that is not always useful. Read the README in
refdb it explains types of refcount isssues and helps a bit for debug them.
Unfortunately its still not easy as you can't automatically tell which ref or
unref is wrong.

Stefan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]