summaryrefslogtreecommitdiff
path: root/include/o3tl/deleter.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'include/o3tl/deleter.hxx')
-rw-r--r--include/o3tl/deleter.hxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/o3tl/deleter.hxx b/include/o3tl/deleter.hxx
index 5b5e67929a15..af06ffa1267c 100644
--- a/include/o3tl/deleter.hxx
+++ b/include/o3tl/deleter.hxx
@@ -43,6 +43,16 @@ template<typename T> struct default_delete
}
};
+template<typename uniqueptr> void reset_preserve_ptr_during(uniqueptr& ptr)
+{
+ // HACK: for the case where the dtor of the obj held by ptr will trigger
+ // functions which expect ptr to still be set during the dtor.
+ // e.g. SdrObject::GetBroadcaster() is called during the destructor
+ // in SdrEdgeObj::Notify(). So delete first, then clear the pointer
+ delete ptr.get();
+ (void)ptr.release();
+}
+
}
#endif