[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-1' - include/sfx2 sfx2/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 1 13:11:31 UTC 2019


 include/sfx2/sidebar/SidebarController.hxx |    2 +
 sfx2/source/sidebar/SidebarController.cxx  |   41 +++++++++++++++++++++--------
 2 files changed, 33 insertions(+), 10 deletions(-)

New commits:
commit e5346b1a4eb688bc32bf5ef554ec27f826d36aa2
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Sep 30 16:02:02 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Oct 1 15:10:48 2019 +0200

    tdf#127306 Fix crash when closing LO after deleting a chart
    
    This crash was introduced with b58aa94f1f365c746135470bceb97cc182c289bc
    
    This patch basically reverts that patch and implements a different fix.
    
    Reviewed-on: https://gerrit.libreoffice.org/79865
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit e6e14b2cafd24179f8675350749878da77a31443)
    
    Change-Id: I394a2f6490d3ee0769c0f78bb8a3980167719893
    Reviewed-on: https://gerrit.libreoffice.org/79919
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index 33cdfc395200..1e14f5a11695 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -166,6 +166,8 @@ public:
 
     tools::Rectangle GetDeckDragArea() const;
 
+    void saveDeckState();
+
 private:
     SidebarController(
         SidebarDockingWindow* pParentWindow,
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 301bcf43bb3c..516648f145e0 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -181,6 +181,9 @@ void SidebarController::registerSidebarForFrame(SidebarController* pController,
 
 void SidebarController::unregisterSidebarForFrame(SidebarController* pController, const css::uno::Reference<css::frame::XController>& xController)
 {
+    pController->saveDeckState();
+    pController->disposeDecks();
+
     css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
         css::ui::ContextChangeEventMultiplexer::get(
             ::comphelper::getProcessComponentContext()));
@@ -204,19 +207,25 @@ void SAL_CALL SidebarController::disposing()
     maFocusManager.Clear();
     mpTabBar.disposeAndClear();
 
-    // save decks settings
-    // Impress shutdown : context (frame) is disposed before sidebar disposing
-    // calc writer : context (frame) is disposed after sidebar disposing
-    // so need to test if GetCurrentContext is still valid regarding msApplication
+    saveDeckState();
 
-    if (GetCurrentContext().msApplication != "none")
+    // clear decks
+    ResourceManager::DeckContextDescriptorContainer aDecks;
+
+    mpResourceManager->GetMatchingDecks (
+            aDecks,
+            GetCurrentContext(),
+            IsDocumentReadOnly(),
+            mxFrame->getController());
+
+    for (const auto& rDeck : aDecks)
     {
-        mpResourceManager->SaveDecksSettings(GetCurrentContext());
-        mpResourceManager->SaveLastActiveDeck(GetCurrentContext(), msCurrentDeckId);
-    }
+        std::shared_ptr<DeckDescriptor> deckDesc = mpResourceManager->GetDeckDescriptor(rDeck.msId);
 
-    // clear decks
-    disposeDecks();
+        VclPtr<Deck> aDeck = deckDesc->mpDeck;
+        if (aDeck)
+            aDeck.disposeAndClear();
+    }
 
     uno::Reference<css::frame::XController> xController = mxFrame->getController();
     if (!xController.is())
@@ -1351,6 +1360,18 @@ void SidebarController::frameAction(const css::frame::FrameActionEvent& rEvent)
     }
 }
 
+void SidebarController::saveDeckState()
+{
+    // Impress shutdown : context (frame) is disposed before sidebar disposing
+    // calc writer : context (frame) is disposed after sidebar disposing
+    // so need to test if GetCurrentContext is still valid regarding msApplication
+    if (GetCurrentContext().msApplication != "none")
+    {
+        mpResourceManager->SaveDecksSettings(GetCurrentContext());
+        mpResourceManager->SaveLastActiveDeck(GetCurrentContext(), msCurrentDeckId);
+    }
+}
+
 } } // end of namespace sfx2::sidebar
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list