Re: [gtk-list] Re: Gtk-- refcounting question



Brian Alexander Martin <briam@cats.ucsc.edu> writes:
> This is a problem becuase the children of a container are kept using the C
> interface, correct?  And there's no way to get to the C++ wrapper from
> that.  Otherwise we could just call unref() on each of it's children..
> Maybe I'm just missing something, but I don't see how haveing C++ handle  
> the refcounts would help.

The actual problem is that current docs say you should use local scope,
so probably people did use it and those will break when we start
using delete :) 

The main thing is that it does need some work. :) (patches are
accepted of course...)

> Here's the current implementation of Gtk_Style::unref
> 
> void Gtk_Style::unref(void)
> {
>   gtk_style_unref(gtkstyle);
> }
> 
> It seems to me that something like this would help:
> 
> void Gtk_Style::unref(void)
> { 
>   if(gtkstyle->ref_count == 1)
>     delete(this);
>   else
>     gtk_style_unref(gtkstyle);
> }

I dont think this works. If someone does gtk_style_unref(mystyle), this impl
just misses that one. => no go. Better go for the finalize thingy mentioned
at previous messages.

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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