resizing tables with widget and unref



Hi,
  I'm trying to resize a table using gtk_table_resize. Unfortunatly,
if you are decreasing the size of the table, you can only decrease
it to the size that covers the widgets in the table. I think it
would be nice if there was a different function for resize that
would automatically destroy any widgets if they exceed the dimension
of the table. So anyway, I started looking into how to do it myself.
It seemed if I used gtk_widget_unref() on all the widgets that
exceeded my table dimensions, I could resize the table like I 
wanted to. That mostly works, the problem is that when I unref
these widgets I get the following warning

Gtk-CRITICAL **: file gtkobject.c: line 1179 (gtk_object_unref): assertion `object->ref_count > 0' failed.

After going through some of the source code, 
gtk_widget_unref is a wrapper for gtk_object_unref,
In gtk_object_unref if the ref_count is 1, (and it is)
then gtk_object_destroy is called.
In gtk_object_destroy the ref_count is bumped up to 2
and object->klass->shutdown is called. This is where the
problem occurs, because inside this routine, the ref_count
is decremented to 1, if it stayed 2 I wouldn't get this message.
Now still inside gtk_object_destroy, it calls gtk_object_unref
again with a ref_count of 1 that should be 2. Since it is 1,
gtk_object_unref calls gtk_object_destroy again and the g_return_if_fail
catches what would be an infinite loop and stops it.
Any ideas to what I should do?
Seems to me there maybe should also be a gtk_table_unattach to 
compliment gtk_table_attach.

TIA
Kerry


-- 
Windows 95: n.
 32 bit extensions and a graphical shell for a 16 bit patch to an
 8 bit operating system originally coded for a 4 bit microprocessor,
 written by a 2 bit company, that can't stand 1 bit of competition.





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