On Thursday 25 February 2010 11:54:37 am Hubbard, Charles W 
wrote:
> Hi Omer,
> 
> Thank you for the quick response.
> 
> I did look through the code for WTreeView::setModel(), and, as near as 
I
>  could tell, the internal pointer to the model (called "model_") is 
simply
>  updated to point at the new model leaving the old model in limbo 
(assuming
>  I don't track it myself).  There is also a note in the
>  WTreeView::setModel() documentation that makes it sound like it is 
up to
>  me to destroy the model when the time comes...
> 
>     " Ownership of the model is not transferred (and thus the 
previously
>  set model is not deleted)."
> 
> I can certainly maintain a pointer to the model myself and delete it 
when
>  we replace the model in the WTreeView with a different one.  We'll try
>  that today and see how it goes.  I didn't figure that was the correct 
Wt
>  way to do it though.  Maybe it is?
> 
> 
> Charlie
> 
> From: omer katz [mailto:[email protected]]
> Sent: Thursday, February 25, 2010 3:11 AM
> To: [email protected]
> Subject: Re: [Wt-interest] I Need Help Understanding the WTreeView 
Widget
> 
> As far as I know WT is responsible for all of the memory management 
and it
>  should delete the old model. Check the code to see if there is a smart
>  pointer in there or a delete statement.

I also believe this is true.  You shouldn't really need to delete stuff 
derived from WObject.  Once all the pointers to it are removed, it goes 
away peacefully.  That's what smart pointers are all about.

I think,
Mike 

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to