Re: gtk_type_new, bug?




Vollmer Marius <mvo@zagadka.ping.de> writes:

> Owen Taylor <owt1@cornell.edu> writes:
> 
> > 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.
> 
> Hmmm^2, I think you are talking about two different things here.
> Mattias thinks about objects, that is, instances of types; and Owen
> thinks about the types themselves.
> 
> gtk_type_new allocates memory for a new instance of a type and
> initializes it.  gtk_type_new can only really allocate GtkObjects, and
> you destroy them by reducing their reference count to zero.
> GtkWidgets are GtkObjects, too, so this applies to GtkWidgets as well.

Momentary thinko there... In my own defense I'll say that gtk_type_new
was probably misnamed, since gtk_xxx_new () generally creates an
xxx. It probably should have by gtk_object_new_from_type() or something.

Regards,
                                        Owen



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