summaryrefslogtreecommitdiff
path: root/include/o3tl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-19 12:39:46 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-19 15:21:38 +0100
commitb99af181a40b464218434e8cf4167cb69c4383df (patch)
treea5c1de492f8d3514bc6827be4738c48b6815b551 /include/o3tl
parent8ed356fb69e024218538c4818ea6ad46799b2c68 (diff)
ofz#6432 bad-cast
ofz#6433 head-use-after-free ofz#6435 bad-cast Change-Id: Ic43edbab68d96e852039c3247853074180fd5091 Reviewed-on: https://gerrit.libreoffice.org/49984 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/o3tl')
-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