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

Szymon Kłos eszkadev at gmail.com
Tue Sep 27 12:31:41 UTC 2016


 sfx2/source/notebookbar/PriorityHBox.cxx |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 9b8e77e2936d3dc44450a68a80de39658d69cd17
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Tue Sep 27 13:50:35 2016 +0200

    tdf#101249 fixed crash after inserting OLE object 2
    
    Change-Id: I1997e69e09cfae10b26a3b3e851583714ee9b3e9
    Reviewed-on: https://gerrit.libreoffice.org/29318
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Szymon Kłos <eszkadev at gmail.com>

diff --git a/sfx2/source/notebookbar/PriorityHBox.cxx b/sfx2/source/notebookbar/PriorityHBox.cxx
index 6071b7e..307bad5 100644
--- a/sfx2/source/notebookbar/PriorityHBox.cxx
+++ b/sfx2/source/notebookbar/PriorityHBox.cxx
@@ -42,6 +42,8 @@ private:
     bool m_bInitialized;
     long m_nNeededWidth;
 
+    ScopedVclPtr<SystemWindow> m_pSystemWindow;
+
     std::vector<IPrioritable*> m_aSortedChilds;
 
 public:
@@ -59,10 +61,10 @@ public:
 
     virtual void dispose() override
     {
-        if (m_bInitialized && SfxViewFrame::Current())
+        if (m_pSystemWindow)
         {
-            SystemWindow* pSystemWindow = SfxViewFrame::Current()->GetFrame().GetSystemWindow();
-            pSystemWindow->RemoveEventListener(LINK(this, PriorityHBox, WindowEventListener));
+            m_pSystemWindow->RemoveEventListener(LINK(this, PriorityHBox, WindowEventListener));
+            m_pSystemWindow.clear();
         }
         VclHBox::dispose();
     }
@@ -99,14 +101,14 @@ public:
         {
             m_bInitialized = true;
 
-            SystemWindow* pSystemWindow = SfxViewFrame::Current()->GetFrame().GetSystemWindow();
-            if (pSystemWindow)
+            m_pSystemWindow = SfxViewFrame::Current()->GetFrame().GetSystemWindow();
+            if (m_pSystemWindow)
             {
-                pSystemWindow->AddEventListener(LINK(this, PriorityHBox, WindowEventListener));
+                m_pSystemWindow->AddEventListener(LINK(this, PriorityHBox, WindowEventListener));
 
                 CalcNeededWidth();
 
-                long nWidth = pSystemWindow->GetSizePixel().Width();
+                long nWidth = m_pSystemWindow->GetSizePixel().Width();
                 SetSizePixel(Size(nWidth, GetSizePixel().Height()));
             }
         }


More information about the Libreoffice-commits mailing list