Re: g_object_ref_sink and GUnowned



Emmanuele Bassi wrote:

>Hi,
>
>On Wed, 2005-12-28 at 12:45 -0500, Havoc Pennington wrote:
>  
>
>>On Thu, 2005-12-22 at 19:02 +0100, Tim Janik wrote:
>>    
>>
>>>in fact, there is no technical reason for this. so many people have
>>>argued this to be better though (havoc even went so far as to argue
>>>why this would be conceptually neccessary), that i decided to simply
>>>sponsor an object type if that helps the majority to understand which
>>>objects are floating and which are not.
>>>      
>>>
>>Not that it's all that relevant ;-) but I also thought a flag in the
>>class would be fine (and I thought a separate class would be fine too),
>>just seems to me it should be somehow marked. James made a good point
>>that right now it's already poorly marked, but why make it worse...
>>    
>>
>
>Instead of having a useless class, there just for making it obvious that
>the object is floating, can't we add a class flag, like:
>
>  void g_type_class_set_is_initially_unowned (gpointer *klass);
>
>and let gtk-doc catch this like it catches other class-level stuff like
>properties and signals?
>
>This way, all the properly documented classes will get a paragraph in
>the documentation saying "Warning, warning, Will Robinson: this object
>has a floating reference when created".
>
>This way we would avoid unnecessary binding breakage like what happenend
>with the Perl bindings, and a warning for the users of the library.
>  
>
This sounds a lot more sensible than a new class.  If some
non-constructor function gives you a GObject, the distinction between a
GObject and GUnowned doesn't tell you anything -- it only tells you
about initial conditions.

Also, modelling the state of the initial reference through inheritance
doesn't seem to account for GtkWindow and its subtypes, which derive
from GtkObject (which would be a GUnowned subclass), but don't start
with a single floating reference to begin with.

James.



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