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

Philippe Jung phil.jung at free.fr
Tue May 19 13:17:21 PDT 2015


 svx/source/sidebar/tools/Popup.cxx |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 3430d2c2b2c4e24b2757015addada9256e399012
Author: Philippe Jung <phil.jung at free.fr>
Date:   Tue May 19 18:32:21 2015 +0200

    tdf#91382 UI: Crash after visiting Sidebar Properties Page
    
    When a popup is displayed, no cleaning / disposing is performed.
    
    Change-Id: Ibae0f977360f8862f2d7ff4c753356975dec3771
    Reviewed-on: https://gerrit.libreoffice.org/15817
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/svx/source/sidebar/tools/Popup.cxx b/svx/source/sidebar/tools/Popup.cxx
index 193bf85..71911a5 100644
--- a/svx/source/sidebar/tools/Popup.cxx
+++ b/svx/source/sidebar/tools/Popup.cxx
@@ -42,8 +42,8 @@ Popup::Popup (
 
 Popup::~Popup()
 {
-    mxControl.reset();
-    mxContainer.reset();
+    mxControl.disposeAndClear();
+    mxContainer.disposeAndClear();
 }
 
 void Popup::Show (ToolBox& rToolBox)
@@ -103,12 +103,16 @@ void Popup::ProvideContainerAndControl()
 
 void Popup::CreateContainerAndControl()
 {
-    mxContainer.reset(VclPtr<PopupContainer>::Create(mpParent));
+    // Clean previous components, if any
+    mxControl.disposeAndClear();
+    mxContainer.disposeAndClear();
+
+    mxContainer.set(VclPtr<PopupContainer>::Create(mpParent));
     mxContainer->SetAccessibleName(msAccessibleName);
     mxContainer->SetPopupModeEndHdl(LINK(this, Popup, PopupModeEndHandler));
     mxContainer->SetBorderStyle(mxContainer->GetBorderStyle() | WindowBorderStyle::MENU);
 
-    mxControl.reset(maControlCreator(mxContainer.get()));
+    mxControl.set(maControlCreator(mxContainer.get()));
 }
 
 IMPL_LINK_NOARG(Popup, PopupModeEndHandler)
@@ -117,8 +121,8 @@ IMPL_LINK_NOARG(Popup, PopupModeEndHandler)
         maPopupModeEndCallback();
 
     // Popup control is no longer needed and can be destroyed.
-    mxControl.reset();
-    mxContainer.reset();
+    mxControl.disposeAndClear();
+    mxContainer.disposeAndClear();
 
     return 0;
 }


More information about the Libreoffice-commits mailing list