[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - 2 commits - sd/source ucb/source

Caolán McNamara caolanm at redhat.com
Fri Jun 3 08:32:39 UTC 2016


 sd/source/ui/sidebar/SlideBackground.cxx |   15 ++++++----
 sd/source/ui/view/ViewShellBase.cxx      |   45 ++++++++++++++++++++-----------
 ucb/source/ucp/tdoc/tdoc_docmgr.cxx      |   13 ++++----
 3 files changed, 46 insertions(+), 27 deletions(-)

New commits:
commit 05560f10b4652f97949f44b9377c2e2355c21602
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 3 09:18:46 2016 +0100

    Resolves: tdf#100199 crash: switch to Display Mode - Master Modes - Notes
    
    via toolbar
    
    Change-Id: I0ad3cce6d96cede8033a05e35c934c3163d214e3
    (cherry picked from commit 9cf0ac710a6ace0a833fa193c7e18c4a7405bc42)

diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index f6c7d89..fd728d6 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -174,12 +174,15 @@ void SlideBackground::Initialize()
     mpFillGrad->SetSelectHdl(LINK(this, SlideBackground, FillColorHdl));
     mpFillAttr->SetSelectHdl(LINK(this, SlideBackground, FillBackgroundHdl));
 
-    ViewShell* pMainViewShell = mrBase.GetMainViewShell().get();
-    DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell);
-    SdPage* mpPage = pDrawViewShell->getCurrentPage();
-    OUString aLayoutName( mpPage->GetLayoutName() );
-    aLayoutName = aLayoutName.copy(0,aLayoutName.indexOf(SD_LT_SEPARATOR));
-    mpMasterSlide->SelectEntry(aLayoutName);
+    if (ViewShell* pMainViewShell = mrBase.GetMainViewShell().get())
+    {
+        DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell);
+        SdPage* mpPage = pDrawViewShell->getCurrentPage();
+        OUString aLayoutName( mpPage->GetLayoutName() );
+        aLayoutName = aLayoutName.copy(0,aLayoutName.indexOf(SD_LT_SEPARATOR));
+        mpMasterSlide->SelectEntry(aLayoutName);
+    }
+
     mpFillStyle->SelectEntryPos(0);
 
     mpDspMasterBackground->SetClickHdl(LINK(this, SlideBackground, DspBackground));
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index b0db267..72b3f3b 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -1243,15 +1243,21 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
                         break;
 
                     case SID_NORMAL_MULTI_PANE_GUI:
-                        pFrameView = mrBase.GetMainViewShell()->GetFrameView();
-                        bState = pFrameView->GetViewShEditMode() == EM_PAGE
-                            && pFrameView->GetPageKind() == PK_STANDARD;
+                        if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
+                        {
+                            pFrameView = pViewShell->GetFrameView();
+                            bState = pFrameView->GetViewShEditMode() == EM_PAGE
+                                && pFrameView->GetPageKind() == PK_STANDARD;
+                        }
                         break;
 
                     case SID_SLIDE_MASTER_MODE:
-                        pFrameView = mrBase.GetMainViewShell()->GetFrameView();
-                        bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
-                            && pFrameView->GetPageKind() == PK_STANDARD;
+                        if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
+                        {
+                            pFrameView = pViewShell->GetFrameView();
+                            bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
+                                && pFrameView->GetPageKind() == PK_STANDARD;
+                        }
                         break;
 
                     case SID_SLIDE_SORTER_MULTI_PANE_GUI:
@@ -1272,21 +1278,30 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
                         break;
 
                     case SID_HANDOUT_MASTER_MODE:
-                        pFrameView = mrBase.GetMainViewShell()->GetFrameView();
-                        bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
-                            && pFrameView->GetPageKind() == PK_HANDOUT;
+                        if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
+                        {
+                            pFrameView = pViewShell->GetFrameView();
+                            bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
+                                && pFrameView->GetPageKind() == PK_HANDOUT;
+                        }
                         break;
 
                     case SID_NOTES_MODE:
-                        pFrameView = mrBase.GetMainViewShell()->GetFrameView();
-                        bState = pFrameView->GetViewShEditMode() == EM_PAGE
-                            && pFrameView->GetPageKind() == PK_NOTES;
+                        if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
+                        {
+                            pFrameView = pViewShell->GetFrameView();
+                            bState = pFrameView->GetViewShEditMode() == EM_PAGE
+                                && pFrameView->GetPageKind() == PK_NOTES;
+                        }
                         break;
 
                     case SID_NOTES_MASTER_MODE:
-                        pFrameView = mrBase.GetMainViewShell()->GetFrameView();
-                        bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
-                            && pFrameView->GetPageKind() == PK_NOTES;
+                        if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
+                        {
+                            pFrameView = pViewShell->GetFrameView();
+                            bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
+                                && pFrameView->GetPageKind() == PK_NOTES;
+                        }
                         break;
 
                     case SID_TOGGLE_TABBAR_VISIBILITY:
commit 63c54ea482ad11b5fcb883f1583c62456cf34ba5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 3 08:48:20 2016 +0100

    Resolves: tdf#55566 opening two docs with open document macro events can crash
    
    OfficeDocumentsManager::buildDocumentsList was set up to ignore disposed
    documents, but didn't ignore documents which were still uninitialized (i.e.
    waiting for the macro warning dialog of the other in-construction document to
    return a decision)
    
    Change-Id: I936e29ab6fad14a33609e8d57d11d7d0178075e4
    (cherry picked from commit 9334aa604f73bf659088c6a1cacba854cfdee5e4)

diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
index b81de10..1af0332 100644
--- a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
@@ -40,6 +40,7 @@
 #include "com/sun/star/frame/XStorable.hpp"
 #include "com/sun/star/frame/ModuleManager.hpp"
 #include "com/sun/star/lang/DisposedException.hpp"
+#include "com/sun/star/lang/NotInitializedException.hpp"
 #include "com/sun/star/util/XCloseBroadcaster.hpp"
 
 #include "tdoc_docmgr.hxx"
@@ -411,10 +412,8 @@ void SAL_CALL OfficeDocumentsManager::documentEventOccured(
     }
 }
 
-
 // lang::XDocumentEventListener (base of document::XDocumentEventListener)
 
-
 // virtual
 void SAL_CALL OfficeDocumentsManager::disposing(
         const lang::EventObject& /*Source*/ )
@@ -422,10 +421,8 @@ void SAL_CALL OfficeDocumentsManager::disposing(
 {
 }
 
-
 // Non-interface.
 
-
 void OfficeDocumentsManager::buildDocumentsList()
 {
     uno::Reference< container::XEnumeration > xEnum
@@ -491,12 +488,16 @@ void OfficeDocumentsManager::buildDocumentsList()
         catch ( lang::DisposedException const & )
         {
             // Note: Due to race conditions the XEnumeration can
-            //       contains docs that already have been closed
+            //       contain docs that have already been closed
+        }
+        catch ( lang::NotInitializedException const & )
+        {
+            // Note: Due to race conditions the XEnumeration can
+            //       contain docs that are still uninitialized
         }
     }
 }
 
-
 uno::Reference< embed::XStorage >
 OfficeDocumentsManager::queryStorage( const OUString & rDocId )
 {


More information about the Libreoffice-commits mailing list