From da6c8343993c4d5c0e7b60eebe27a611def7f250 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 11 May 2021 15:03:11 +0200 Subject: don't leak when the SfxHintPoster is disabled Change-Id: Ia445feb93b7e65e1b64c69efded9a3e779cb578e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115405 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sfx2/source/notify/hintpost.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/source/notify/hintpost.cxx b/sfx2/source/notify/hintpost.cxx index 0020d3beac69..446c7a954ba9 100644 --- a/sfx2/source/notify/hintpost.cxx +++ b/sfx2/source/notify/hintpost.cxx @@ -37,8 +37,11 @@ void SfxHintPoster::Post(std::unique_ptr pHintToPost) IMPL_LINK(SfxHintPoster, DoEvent_Impl, void*, pPostedHint, void) { + auto pRequest = static_cast(pPostedHint); if (m_Link) - m_Link(std::unique_ptr(static_cast(pPostedHint))); + m_Link(std::unique_ptr(pRequest)); + else + delete pRequest; ReleaseRef(); } -- cgit