Re: Basic question refPtr



Well, in common words, that wrapper handles reference counting on some
object. So, that object could be destroyed once all references were
removed. ( It is not std::auto_ptr<> )

Simple example.

You could create Pixbuf (from file, data). Pixbuf object has no
references yet. So, if you create another pixbuf and assign it to same
RefPtr, then old object will be destroyed.

But, if you first will assign old Pixbuf to some Image widget, then it
will have reference++, and won't be destroyed when you recreating
RefPtr. It should be destroyed now once Image widget unreferenced it.

Hope, that clear enough.

В Втр, 10/05/2011 в 12:04 +0200, Kees Kling пишет:
> Hi
> 
> What I'm doing basically is take a Glib::RefPtr declared in the class 
> and initialized in the CTOR. Later in one of the methods (nosense) I 
> reinit the refptr. I want to know if memory allocated in the first init 
> will be destroyed by the second init  or do I have to take care for it 
> myself and how?
> 

-- 
Andrew E. Makeev <andrew solvo ru>
Solvo Logistic



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