Re: GTK_FLOATING broken in 2.9?



Havoc Pennington wrote:

>On Tue, 2005-12-20 at 17:27 +0100, Tim Janik wrote:
>  
>
>>GObject:
>>- created with ref_count=1
>>- not initially floating
>>    
>>
>
>This is the key I think. The point of my theoretical rant is that I
>think it's really bad if I do:
>
> obj = g_object_new(TYPE_WHATEVER);
>
>and don't know whether I own a refcount or not. The programmer needs to
>know this.
>  
>
We are already in this situation with GTK, the rules being:

   1. if it is a GtkWindow or subclass, then it is not floating, and you
      don't own the reference.
   2. otherwise, if it is a GtkObject or subclass it is floating and you
      don't own the reference
   3. otherwise, if it is some other GObject that implements floating
      reference semantics, it will probably be floating and you don't
      own the reference
   4. otherwise, it is not floating and you do own the reference.


Pushing the floating flag down to GObject seems like it should simplify
things in the long run (even if it will cause some temporary pain for
language bindings).  Personally, I found the GtkWindow behaviour a lot
more confusing.

James.



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