owned by a parent QObject
E.g. QGraphicsItem subclasses are not QObjects themselves, but
are owned by a QObject QGraphicsScene. Depending on whether the
graphics item is deleted first or the scene, we can end up with
a double-free situation.
Fix this by creating a QObjectParentUniquePtr smart pointer which
is automatically nulled if the parent QObject (e.g. the QGraphicsScene)
is deleted first.
(Adapted from existing QObjectUniquePtr logic and logic in
QgsSnapIndicator)