summaryrefslogtreecommitdiff
path: root/sfx2/source/sidebar/UnoDeck.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-06-03 14:04:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-06-03 14:20:32 +0100
commitfce299fc64fcfe5280966631613edda7e6031c16 (patch)
tree51fe9c57d5d1266de2e65697250d918febd55b29 /sfx2/source/sidebar/UnoDeck.cxx
parenta22af0b1702d625f12711e9997daebbddb02b6e0 (diff)
Resolves: tdf#96008 crash when an extension with legacy decks is installed
ReadLegacyAddons modifies its vectors of maDecks and maPanels in this case, but a load of things have (c++) references contents of the original contents. Its such a rats nest that the easiest thing seems to be to make them vectors of shared_ptrs and hold DeckDescriptor and PanelDescriptor by shared_ptr and it all works out Change-Id: I3f628e12c7d5f4224d14d5e0769e450ce893fb54
Diffstat (limited to 'sfx2/source/sidebar/UnoDeck.cxx')
-rw-r--r--sfx2/source/sidebar/UnoDeck.cxx41
1 files changed, 20 insertions, 21 deletions
diff --git a/sfx2/source/sidebar/UnoDeck.cxx b/sfx2/source/sidebar/UnoDeck.cxx
index 9305d449ed77..4fc0e158f07f 100644
--- a/sfx2/source/sidebar/UnoDeck.cxx
+++ b/sfx2/source/sidebar/UnoDeck.cxx
@@ -67,16 +67,16 @@ void SAL_CALL SfxUnoDeck::setTitle( const OUString& newTitle )
SidebarController* pSidebarController = getSidebarController();
pSidebarController->CreateDeck(mDeckId);
- DeckDescriptor* pDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
+ std::shared_ptr<DeckDescriptor> xDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
- if (pDeckDescriptor)
+ if (xDeckDescriptor)
{
- Deck* pDeck = pDeckDescriptor->mpDeck;
+ Deck* pDeck = xDeckDescriptor->mpDeck;
DeckTitleBar* pTitleBar = pDeck->GetTitleBar();
pTitleBar->SetTitle(newTitle);
- pDeckDescriptor->msTitle = newTitle;
- pDeckDescriptor->msHelpText = newTitle;
+ xDeckDescriptor->msTitle = newTitle;
+ xDeckDescriptor->msHelpText = newTitle;
pSidebarController->notifyDeckTitle(mDeckId);
}
@@ -133,11 +133,11 @@ void SAL_CALL SfxUnoDeck::setOrderIndex( const sal_Int32 newOrderIndex )
SolarMutexGuard aGuard;
SidebarController* pSidebarController = getSidebarController();
- DeckDescriptor* pDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
+ std::shared_ptr<DeckDescriptor> xDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
- if (pDeckDescriptor)
+ if (xDeckDescriptor)
{
- pDeckDescriptor->mnOrderIndex = newOrderIndex;
+ xDeckDescriptor->mnOrderIndex = newOrderIndex;
// update the sidebar
pSidebarController->NotifyResize();
}
@@ -157,10 +157,10 @@ void SAL_CALL SfxUnoDeck::moveFirst()
if (curOrderIndex != minIndex) // is deck already in place ?
{
minIndex -= 1;
- DeckDescriptor* pDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
- if (pDeckDescriptor)
+ std::shared_ptr<DeckDescriptor> xDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
+ if (xDeckDescriptor)
{
- pDeckDescriptor->mnOrderIndex = minIndex;
+ xDeckDescriptor->mnOrderIndex = minIndex;
// update the sidebar
pSidebarController->NotifyResize();
}
@@ -181,10 +181,10 @@ void SAL_CALL SfxUnoDeck::moveLast()
if (curOrderIndex != maxIndex) // is deck already in place ?
{
maxIndex += 1;
- DeckDescriptor* pDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
- if (pDeckDescriptor)
+ std::shared_ptr<DeckDescriptor> xDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
+ if (xDeckDescriptor)
{
- pDeckDescriptor->mnOrderIndex = maxIndex;
+ xDeckDescriptor->mnOrderIndex = maxIndex;
// update the sidebar
pSidebarController->NotifyResize();
}
@@ -214,10 +214,10 @@ void SAL_CALL SfxUnoDeck::moveUp()
if (curOrderIndex != previousIndex) // is deck already in place ?
{
previousIndex -= 1;
- DeckDescriptor* pDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
- if (pDeckDescriptor)
+ std::shared_ptr<DeckDescriptor> xDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
+ if (xDeckDescriptor)
{
- pDeckDescriptor->mnOrderIndex = previousIndex;
+ xDeckDescriptor->mnOrderIndex = previousIndex;
// update the sidebar
pSidebarController->NotifyResize();
}
@@ -248,17 +248,16 @@ void SAL_CALL SfxUnoDeck::moveDown()
if (curOrderIndex != nextIndex) // is deck already in place ?
{
nextIndex += 1;
- DeckDescriptor* pDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
- if (pDeckDescriptor)
+ std::shared_ptr<DeckDescriptor> xDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
+ if (xDeckDescriptor)
{
- pDeckDescriptor->mnOrderIndex = nextIndex;
+ xDeckDescriptor->mnOrderIndex = nextIndex;
// update the sidebar
pSidebarController->NotifyResize();
}
}
}
-
sal_Int32 SfxUnoDeck::GetMinOrderIndex(ResourceManager::DeckContextDescriptorContainer aDecks)
{
SidebarController* pSidebarController = getSidebarController();