summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-09-30 16:02:02 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-10-01 17:14:38 +0200
commit59369a56e3a09a0838ffe5b87f8e4e3dbb9ed5b4 (patch)
tree96e95059c3d4ba9a4e2c996bf25cd36bab73343a
parent37fcbc3374afad789b73cc1127b16088357f7701 (diff)
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@cib.de> (cherry picked from commit e6e14b2cafd24179f8675350749878da77a31443) Change-Id: I394a2f6490d3ee0769c0f78bb8a3980167719893 Reviewed-on: https://gerrit.libreoffice.org/79919 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--include/sfx2/sidebar/SidebarController.hxx2
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx41
2 files changed, 33 insertions, 10 deletions
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: */