Re: [gtk-list] Re: gtk_type_new, bug?



Owen Taylor wrote:
> 
> Mattias Gronlund <Mattias.Gronlund@sa.erisoft.se> writes:
> 
> > In gtk/gtktypeutils.c there is a funcion gtk_type_new(GtkType type) that
> > allocate some memory, but I can't find any function that will free that
> > memory. Shouldn't there be a gtk_type_destroy(GtkObject *object)
> > function
> > to complement gtk_type_new(GtkType type)?
> 
> Hmmm, I think the general attitude toward that is that once a type
> is created, it is created. You can't destroy a type because some
> of the information is stored statically in the widget implementations.
> 
> (You could destroy all the types just before exiting, perhaps,
>  but the only point in that would be if you were running Purify
>  or something. I would expect that there are whole lot of other
>  finite memory "leaks" of that type, though.)
> 

Sounds right, yes it was Purify who traced the leak, but the memory
leak appear when closing the editable dialog in testgtk and not when
exiting the application.

OK, I learned a lot tonight, it was a bug in scrolledwindow.c that I
ran into. I include the patch in this mail, isn't that enough for
patches that is as small as this one?

--- gtk/gtkscrolledwindow.c.orig        Mon Mar  2 21:59:15 1998
+++ gtk/gtkscrolledwindow.c     Wed Mar 11 00:41:58 1998
@@ -216,6 +216,8 @@
   gtk_widget_unref (scrolled_window->viewport);
   gtk_widget_unref (scrolled_window->hscrollbar);
   gtk_widget_unref (scrolled_window->vscrollbar);
+
+  GTK_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static void


/Mattias



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