Take the 2-minute tour ×  This question always troubles me
especially when I'm programming with Qt. Since Qt uses Object
Ownership trees, passing a pointer e.g. via
myBoostSharedPtr.get() can implicitly transfer ownership. Now
consider the case where some Qt Object gets destroyed and the
whole Object Tree is destroyed but the smart-pointer is still
alive e.g. as member of a different class. What happens if the
smart-pointer gets deleted afterwards ? Double deletion with all
the nasty consequences ? Do some smart-pointer implementations
prevent this ?  share|improve this question I actually ran into
this type of problem with QSharedPointer which is conceptually
very similar to boost's shared_ptr. I wrote a blog entry about
my findings: blog.codef00.com/2011/12/15/not-so-much-fun-with-
qsharedpointer –  Evan Teran Mar 3 '12 at 6:13 add comment  3
Answers  up vote 13 down vote accepted  I'm so tempted to do a
rant on the weaknesses of Qt's memory model where a lot of the
API still accepts raw pointers with the ex