non-attached style detached in gtkinvisible.



Ok, this was a sucker to track down.

Destroying a GtkInvisible eventually results in it becoming unrealized and
it's widget->style to be detached. But gtk_invisible_realize doesn't
attach the style (it really doesn't need any frickin style), this makes
the widget style attach counter to decrease by one each time a
GtkInvisible is unrealized, and eventually the style will be destroyed
while there are still references to it.

Here is a patch that just attaches the style. This is a bit wasteful,
since it is not needed, but it is a simple way to fix the problem.

This bug is probably in Gtk+ 1.2.x too.

/ Alex

Index: gtkinvisible.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkinvisible.c,v
retrieving revision 1.8
diff -u -p -r1.8 gtkinvisible.c
--- gtkinvisible.c	2000/12/11 16:43:47	1.8
+++ gtkinvisible.c	2000/12/18 13:05:59
@@ -134,6 +134,8 @@ gtk_invisible_realize (GtkWidget *widget

   widget->window = gdk_window_new (NULL, &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
+
+  widget->style = gtk_style_attach (widget->style, widget->window);
 }

 static void





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