Re: The use of RefPtr



On Sat, 2009-03-07 at 01:57 -0500, Hubert Figuiere wrote:
> There is no point in trying to make things more complex to make on
> case marginally less complex. It is not like you have to track the
> model to delete it when needed.

Hmm, I'm not sure we fully understand each other. My issue is that I
want to have a non-dynamically allocated TreeModel (or derivation of
one). The problem of course is that you can't have a RefPtr going ahead
and trying to delete a piece of non-dynamically allocated memory. This
would obviously cause the program to crash. I want my TreeModel freed
when it goes out of scope. The question is then, how do I get my
ComboBox to use my non-dynamically allocated TreeModel without crashing
the program?

> Also the last bit: even if you idea had an advantage, it woudln't be 
> feasible without breaking the ABI. That's something the Gtkmm 
> maintainers have been trying to avoid.

My idea doesn't involve modifying gtkmm, it is purely a user solution.
The idea is to call reference() once on my non-dynamically allocated
TreeModel so that the destruction of RefPtrs pointing to it never
actually reach a count of zero and make it try to delete itself. I am
assuming that this would be safe and that the TreeModel would just get
destroyed when it goes out of scope and all will be well. My question is
at this point is whether or not this is safe. Is there more going on
inside it then I am taking into account?
--
        Eddie Carle
        
        This message has been signed with an RFC4880 signature. It is
        guaranteed to have originated from Eddie Carle and it's contents
        can be validated against it's signature.

Attachment: signature.asc
Description: This is a digitally signed message part



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