
9 May
2007
9 May
'07
11:37 p.m.
Great, that was it. Best regards. Peter Dimov a écrit :
Olivier Tournaire wrote:
if ( typeid(m_rectangle.get()) == typeid(rectangle*) ) { boost::shared_ptr<rectangle> rect( (rectangle*)(m_rectangle.get()) );
This is the cause of your immediate problem. You are creating a second shared_ptr to the same raw pointer. This second shared_ptr has no knowledge of m_rectangle and will call delete on the raw pointer when it goes out of scope. Why not just use m_rectangle inside the if? You don't need the cast or the second shared_ptr.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users