diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-20 13:23:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-20 16:47:10 +0200 |
commit | dbd45a00db54af7d960654932ef17eba4ef457ca (patch) | |
tree | 7ddc55cc0e31712bc176449f678a47fa939ce538 /toolkit/source/awt | |
parent | 157fb80b9c147c2ab18cb81ee48eab0c8e54b36a (diff) |
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@collabora.co.uk>
Diffstat (limited to 'toolkit/source/awt')
-rw-r--r-- | toolkit/source/awt/vclxwindow.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
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() ) |