[Libreoffice-commits] core.git: sfx2/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue May 11 10:52:03 UTC 2021


 sfx2/source/view/lokhelper.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5ed6aae8b572fd2b7623454acbb1de791f166c45
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue May 11 09:45:13 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue May 11 12:51:19 2021 +0200

    fix leak in LOKPostAsyncEvent
    
    Change-Id: I0bae5c59d75b315c1c086640a8a9bb638a82923d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115381
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 0487ff96922e..389c45392b46 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -612,9 +612,11 @@ namespace
 
     void LOKPostAsyncEvent(void* pEv, void*)
     {
-        LOKAsyncEventData* pLOKEv = static_cast<LOKAsyncEventData*>(pEv);
+        std::unique_ptr<LOKAsyncEventData> pLOKEv(static_cast<LOKAsyncEventData*>(pEv));
         if (pLOKEv->mpWindow->IsDisposed())
+        {
             return;
+        }
 
         int nView = SfxLokHelper::getView(nullptr);
         if (nView != pLOKEv->mnView)
@@ -676,8 +678,6 @@ namespace
             assert(false);
             break;
         }
-
-        delete pLOKEv;
     }
 
     void postEventAsync(LOKAsyncEventData *pEvent)


More information about the Libreoffice-commits mailing list