[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Samuel Mehrbrodt (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 1 07:48:14 UTC 2019
include/sfx2/sidebar/SidebarController.hxx | 2 +
sfx2/source/sidebar/SidebarController.cxx | 41 +++++++++++++++++++++--------
2 files changed, 33 insertions(+), 10 deletions(-)
New commits:
commit e6e14b2cafd24179f8675350749878da77a31443
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Sep 30 16:02:02 2019 +0200
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Tue Oct 1 09:47:34 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.
Change-Id: I394a2f6490d3ee0769c0f78bb8a3980167719893
Reviewed-on: https://gerrit.libreoffice.org/79865
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index fa051bf549be..596382a36888 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -167,6 +167,8 @@ public:
sal_Int32 getMaximumWidth() const { return mnMaximumSidebarWidth; }
void setMaximumWidth(sal_Int32 nMaximumWidth) { mnMaximumSidebarWidth = nMaximumWidth; }
+ void saveDeckState();
+
private:
SidebarController(SidebarDockingWindow* pParentWindow, const SfxViewFrame* pViewFrame);
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index ffefcf1d5f8a..f04278a25852 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -221,6 +221,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()));
@@ -258,19 +261,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())
@@ -1563,6 +1572,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