summaryrefslogtreecommitdiff
path: root/vcl/source/window/window.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-12 11:33:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-12 13:37:18 +0200
commit5aa60be574ece81b27c8f63e6e809871c694dba0 (patch)
treec6e272e967983ddff1df54bd6c4b0e9591032344 /vcl/source/window/window.cxx
parentdb35b9086476259fa2c047f2e4dfe7862d026530 (diff)
fix leak in VCLXWindow
which is a little tricky because dispose() can be called from either side (vcl::Window or VCLXWindow) Change-Id: Ifc380feec6bec84b2cf7d903d42db00755d4cd97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115441 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/window/window.cxx')
-rw-r--r--vcl/source/window/window.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 44f5438e3864..c0a9bf8b141b 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -547,6 +547,9 @@ void Window::dispose()
mpWindowImpl->mpFrameData = nullptr;
}
+ if (mpWindowImpl->mxWindowPeer)
+ mpWindowImpl->mxWindowPeer->dispose();
+
// should be the last statements
mpWindowImpl.reset();
@@ -3104,11 +3107,15 @@ const OUString& Window::GetHelpText() const
void Window::SetWindowPeer( Reference< css::awt::XWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow )
{
- if (!mpWindowImpl)
+ if (!mpWindowImpl || mpWindowImpl->mbInDispose)
return;
// be safe against re-entrance: first clear the old ref, then assign the new one
- mpWindowImpl->mxWindowPeer.clear();
+ if (mpWindowImpl->mxWindowPeer)
+ {
+ mpWindowImpl->mxWindowPeer->dispose();
+ mpWindowImpl->mxWindowPeer.clear();
+ }
mpWindowImpl->mxWindowPeer = xPeer;
mpWindowImpl->mpVCLXWindow = pVCLXWindow;