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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 26 19:57:49 UTC 2021


 vcl/source/window/dockmgr.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit bbb3f36877807a5f6106956d7497f281169d9421
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Feb 26 12:04:50 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Feb 26 20:57:04 2021 +0100

    protect against callback destroying this object
    
    Change-Id: I4527f9bf5f2983083be8055dfb6277ed2dcd8c39
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111626
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 66eccfa36150..bdef0d5581ef 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -864,8 +864,10 @@ IMPL_LINK_NOARG(ImplDockingWindowWrapper, PopupModeEnd, FloatingWindow*, void)
     xWindow->SetParent( pRealParent );
     xWindow->mpWindowImpl->mpRealParent = pRealParent;
 
-    maPopupModeEndHdl.Call(mpFloatWin);
-    mpFloatWin.disposeAndClear();
+    // take ownership to local variable to protect against maPopupModeEndHdl destroying this object
+    auto xFloatWin = std::move(mpFloatWin);
+    maPopupModeEndHdl.Call(xFloatWin);
+    xFloatWin.disposeAndClear();
 
     // call handler - which will destroy the window and thus the wrapper as well !
     xWindow->CallEventListeners( VclEventId::WindowEndPopupMode, &aData );


More information about the Libreoffice-commits mailing list