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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu May 13 18:23:16 UTC 2021


 toolkit/source/awt/vclxwindow.cxx |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit f23bc008aefe7d5ab2da8a283fe899798d15a2fa
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu May 13 18:45:18 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu May 13 20:22:25 2021 +0200

    fix leak in VCLXWindowImpl
    
    where the manual acquire() was not matched by a release() if we disposed
    while an event was in progress
    
    Change-Id: I307997772ccdfc912a16f0fb233f4e933f95cfbf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115566
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index dfc6ba8f7c00..616d93fe834d 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -221,10 +221,14 @@ void VCLXWindowImpl::disposing()
 {
     SolarMutexGuard aGuard;
     if ( mnCallbackEventId )
+    {
         Application::RemoveUserEvent( mnCallbackEventId );
-    mnCallbackEventId = nullptr;
+        mnCallbackEventId = nullptr;
+        // we acquired our VCLXWindow once before posting the event, release this one ref now
+        mrAntiImpl.release();
+    }
 
-    mbDisposed= true;
+    mbDisposed = true;
 
     css::lang::EventObject aEvent;
     aEvent.Source = mrAntiImpl;
@@ -275,9 +279,7 @@ IMPL_LINK_NOARG(VCLXWindowImpl, OnProcessCallbacks, void*, void)
         // we acquired our VCLXWindow once before posting the event, release this one ref now
         mrAntiImpl.release();
 
-        if ( !mnCallbackEventId )
-            // we were disposed while waiting for the mutex to lock
-            return;
+        assert( mnCallbackEventId && "should not be possible to call us if the event was removed");
 
         mnCallbackEventId = nullptr;
     }


More information about the Libreoffice-commits mailing list