
9 May
2007
9 May
'07
10:27 p.m.
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.