Re: GtkWindow destroy problem



On Thu, 6 Sep 2001, Darin Adler wrote:

> on 9/5/01 11:42 PM, Tim Janik at timj gtk org wrote:
> 
> > not in GtkObject, since this is valid code (apart from GTK_TYPE_OBEJCT
> > being abstract):
> > o = g_object_new (GTK_TYPE_OBJECT, NULL);
> > gtk_object_unref (o);
> 
> If anyone other than you tried to tell me this was valid, I would tell him
> he was wrong.
> 
> Havoc has drilled it into my head over the last year that the floating
> reference cannot be legally removed with unref.

havoc is right in that people should usually do ref/sink on gtk objects.

however, conceptually GtkObject is just a normally ref counted object
and the floating flag is a kludge for widgets to maintain the gtk specific
API semantics of gtk_container_add() automatically taking over initial
ownership.

but if you use GtkObject in a normally refcounted framework other than the
gtk widget framework, you should be able to simply do
  o = gtk_object_new (GTK_TYPE_OBJECT, NULL);
  gtk_object_unref (o);
and ignore the gtk specific floating kludge.

of course, this is becoming less important with 2.0, since now people
can actually derive from GObject if they just need an object system
base type and don't want to fool with widgets.

> 
>     -- Darin
> 

---
ciaoTJ





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