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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu May 20 14:47:47 UTC 2021


 toolkit/source/awt/vclxwindow.cxx |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit dbd45a00db54af7d960654932ef17eba4ef457ca
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu May 20 13:23:52 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu May 20 16:47:10 2021 +0200

    fix VCLXWindow related leaks
    
    Change-Id: If2c0a599bdfed4c5390c4d3628157c7d942d5cf8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115870
    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 215fdbaf2d88..80e9db718500 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -220,6 +220,11 @@ VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, bool _bWithDefaultProps
 void VCLXWindowImpl::disposing()
 {
     SolarMutexGuard aGuard;
+
+    assert(!mbDisposed);
+
+    mbDisposed = true;
+
     if ( mnCallbackEventId )
     {
         Application::RemoveUserEvent( mnCallbackEventId );
@@ -227,8 +232,7 @@ void VCLXWindowImpl::disposing()
         // we acquired our VCLXWindow once before posting the event, release this one ref now
         mrAntiImpl.release();
     }
-
-    mbDisposed = true;
+    maCallbackEvents.clear();
 
     css::lang::EventObject aEvent;
     aEvent.Source = mrAntiImpl;
@@ -243,6 +247,7 @@ void VCLXWindowImpl::disposing()
     maPaintListeners.disposeAndClear( aEvent );
     maContainerListeners.disposeAndClear( aEvent );
     maTopWindowListeners.disposeAndClear( aEvent );
+    maWindow2Listeners.disposeAndClear( aEvent );
 
     ::toolkit::WindowStyleSettings* pStyleSettings = static_cast< ::toolkit::WindowStyleSettings* >( mxWindowStyleSettings.get() );
     if ( pStyleSettings != nullptr )
@@ -334,6 +339,8 @@ VCLXWindow::~VCLXWindow()
 
 void VCLXWindow::ImplExecuteAsyncWithoutSolarLock( const Callback& i_callback )
 {
+    if (mpImpl->mbDisposing)
+        return;
     mpImpl->callBackAsync( i_callback );
 }
 
@@ -345,6 +352,8 @@ void VCLXWindow::ImplExecuteAsyncWithoutSolarLock( const Callback& i_callback )
 
 void VCLXWindow::SetWindow( const VclPtr<vcl::Window> &pWindow )
 {
+    assert(!mpImpl->mbDisposing || !pWindow);
+
     if ( GetWindow() )
     {
         GetWindow()->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
@@ -416,6 +425,8 @@ namespace
 
 void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
 {
+    if (mpImpl->mbDisposing)
+        return;
     css::uno::Reference< css::uno::XInterface > xThis( static_cast<cppu::OWeakObject*>(this) );
 
     switch ( rVclWindowEvent.GetId() )


More information about the Libreoffice-commits mailing list