diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-10-08 19:14:35 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-10-09 20:42:11 +0200 |
commit | 33972dea7d8849842929060be8f970e090077e4c (patch) | |
tree | b491d8ff51cf52b26177778a161142d61764426b /sfx2 | |
parent | c129a415ad0998b1544aed756316ed869148ef7b (diff) |
correctly dispose the chart sidebar when leaving chart, tdf#94292
This is a much better approach than my old one that tried to use the
correct XModel with the chart sidebar. Now everytime we leave the chart
edit mdoe we destroy the chart sidebar panels and recreate them when we
go back to chart edit mode.
As a result we no longer need to have worry that much about using the
correct ChartModel and about the lifecycle of the ChartModel.
Change-Id: Ie85ad82968e20a81f059d4bd930a83a70da35fc9
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 57643941eb10..896b06d61133 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -174,6 +174,7 @@ void SidebarController::registerSidebarForFrame(SidebarController* pController, void SidebarController::unregisterSidebarForFrame(SidebarController* pController, css::uno::Reference<css::frame::XController> xController) { + pController->disposeDecks(xController); css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( css::ui::ContextChangeEventMultiplexer::get( ::comphelper::getProcessComponentContext())); @@ -183,22 +184,16 @@ void SidebarController::unregisterSidebarForFrame(SidebarController* pController xController); } -void SAL_CALL SidebarController::disposing() +void SidebarController::disposeDecks(css::uno::Reference<css::frame::XController> xController) { - mpCloseIndicator.disposeAndClear(); - - maFocusManager.Clear(); - mpTabBar.disposeAndClear(); - - - // clear decks + // clear decks ResourceManager::DeckContextDescriptorContainer aDecks; mpResourceManager->GetMatchingDecks ( aDecks, GetCurrentContext(), IsDocumentReadOnly(), - mxFrame->getController()); + xController); for (ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck(aDecks.begin()), iEnd(aDecks.end()); @@ -206,9 +201,25 @@ void SAL_CALL SidebarController::disposing() { const DeckDescriptor* deckDesc = mpResourceManager->GetDeckDescriptor(iDeck->msId); VclPtr<Deck> aDeck = deckDesc->mpDeck; + if (aDeck == mpCurrentDeck) + { + mpCurrentDeck.clear(); + maFocusManager.Clear(); + } if (aDeck) + { aDeck.disposeAndClear(); + mpResourceManager->SetDeckToDescriptor(iDeck->msId, VclPtr<Deck>()); + } } +} + +void SAL_CALL SidebarController::disposing() +{ + mpCloseIndicator.disposeAndClear(); + + maFocusManager.Clear(); + mpTabBar.disposeAndClear(); uno::Reference<css::frame::XController> xController = mxFrame->getController(); if (!xController.is()) |