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

Caolán McNamara caolanm at redhat.com
Thu May 7 06:16:16 PDT 2015


 sd/source/ui/dlg/NavigatorChildWindow.cxx |    4 +++-
 sd/source/ui/dlg/navigatr.cxx             |   15 ++++++++++-----
 sd/source/ui/inc/navigatr.hxx             |    4 ++--
 sd/source/ui/sidebar/NavigatorWrapper.cxx |    4 ++--
 4 files changed, 17 insertions(+), 10 deletions(-)

New commits:
commit 15532c9a1f8259d258acd1329661c0c920736662
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 7 14:12:22 2015 +0100

    VclPtr: clicking on sidebar impress navigator crashes
    
    not sure how this ever worked, the callback is called
    at the end of the ctor and the callback is in the parent
    obj which dereferences the pointer to this obj before
    that pointer has been set.
    
    Just split the ctor into a ctor and a follow up
    post ctor init method.
    
    Change-Id: I04855c8ac95592801f2ebf0b974a9a7b597d0327

diff --git a/sd/source/ui/dlg/NavigatorChildWindow.cxx b/sd/source/ui/dlg/NavigatorChildWindow.cxx
index 0beb6d1..e1b8306 100644
--- a/sd/source/ui/dlg/NavigatorChildWindow.cxx
+++ b/sd/source/ui/dlg/NavigatorChildWindow.cxx
@@ -57,7 +57,9 @@ NavigatorChildWindow::NavigatorChildWindow (
         pParent,
         this,
         SdResId( FLT_NAVIGATOR ),
-        pBindings,
+        pBindings);
+
+    pNavWin->SetUpdateRequestFunctor(
         ::boost::bind(RequestNavigatorUpdate, pBindings));
 
     SetWindow( pNavWin );
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index 987818b..ec19ebf 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -65,8 +65,7 @@ SdNavigatorWin::SdNavigatorWin(
     vcl::Window* pParent,
     ::sd::NavigatorChildWindow* pChWinCtxt,
     const SdResId& rSdResId,
-    SfxBindings* pInBindings,
-    const UpdateRequestFunctor& rUpdateRequest)
+    SfxBindings* pInBindings)
     : vcl::Window( pParent, rSdResId )
     , maToolbox ( VclPtr<ToolBox>::Create( this, SdResId( 1 ) ) )
     , maTlbObjects( VclPtr<SdPageObjsTLB>::Create( this, SdResId( TLB_OBJECTS ) ) )
@@ -76,6 +75,8 @@ SdNavigatorWin::SdNavigatorWin(
       // On changes of the DragType: adjust SelectionMode of TLB!
     , meDragType ( NAVIGATOR_DRAGTYPE_EMBEDDED )
     , mpBindings ( pInBindings )
+    , mpNavigatorCtrlItem( 0 )
+    , mpPageNameCtrlItem( 0 )
     , maImageList ( SdResId( IL_NAVIGATR ) )
 {
     maTlbObjects->SetViewFrame( mpBindings->GetDispatcher()->GetFrame() );
@@ -84,9 +85,6 @@ SdNavigatorWin::SdNavigatorWin(
 
     maTlbObjects->SetAccessibleName(SD_RESSTR(STR_OBJECTS_TREE));
 
-    mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings, rUpdateRequest);
-    mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings, rUpdateRequest);
-
     ApplyImageList(); // load images *before* calculating sizes to get something useful !!!
 
     Size aTbxSize( maToolbox->CalcWindowSizePixel() );
@@ -145,6 +143,13 @@ SdNavigatorWin::SdNavigatorWin(
     if (pDockingParent != NULL)
         pDockingParent->SetMinOutputSizePixel( maMinSize );
 
+}
+
+void SdNavigatorWin::SetUpdateRequestFunctor(const UpdateRequestFunctor& rUpdateRequest)
+{
+    mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings, rUpdateRequest);
+    mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings, rUpdateRequest);
+
     // InitTlb; is initiated over Slot
     if (rUpdateRequest)
         rUpdateRequest();
diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx
index ed682fd..77b7a7e 100644
--- a/sd/source/ui/inc/navigatr.hxx
+++ b/sd/source/ui/inc/navigatr.hxx
@@ -95,8 +95,8 @@ public:
         vcl::Window* pParent,
         ::sd::NavigatorChildWindow* pChildWinContext,
         const SdResId& rSdResId,
-        SfxBindings* pBindings,
-        const UpdateRequestFunctor& rUpdateRequest);
+        SfxBindings* pBindings);
+    void SetUpdateRequestFunctor(const UpdateRequestFunctor& rUpdateRequest);
     virtual ~SdNavigatorWin();
     virtual void                dispose() SAL_OVERRIDE;
 
diff --git a/sd/source/ui/sidebar/NavigatorWrapper.cxx b/sd/source/ui/sidebar/NavigatorWrapper.cxx
index 376d22b..972a737 100644
--- a/sd/source/ui/sidebar/NavigatorWrapper.cxx
+++ b/sd/source/ui/sidebar/NavigatorWrapper.cxx
@@ -37,9 +37,9 @@ NavigatorWrapper::NavigatorWrapper (
         this,
         (::sd::NavigatorChildWindow*)NULL,
         SdResId(FLT_NAVIGATOR),
-        pBindings,
-        ::boost::bind(&NavigatorWrapper::UpdateNavigator, this)))
+        pBindings))
 {
+    maNavigator->SetUpdateRequestFunctor(::boost::bind(&NavigatorWrapper::UpdateNavigator, this));
     maNavigator->SetPosSizePixel(
         Point(0,0),
         GetSizePixel());


More information about the Libreoffice-commits mailing list