Skip to content

Commit

Permalink
Resolves: tdf#96008 crash when an extension with legacy decks is inst…
Browse files Browse the repository at this point in the history
…alled

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
  • Loading branch information
Caolán McNamara committed Jun 3, 2016
1 parent a22af0b commit fce299f
Show file tree
Hide file tree
Showing 8 changed files with 174 additions and 193 deletions.
15 changes: 6 additions & 9 deletions include/sfx2/sidebar/ResourceManager.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,8 @@ public:
ResourceManager();
~ResourceManager();

const DeckDescriptor* GetDeckDescriptor(const OUString& rsDeckId) const;
DeckDescriptor* GetDeckDescriptor(const OUString& rsDeckId);

const PanelDescriptor* GetPanelDescriptor(const OUString& rsPanelId) const;
PanelDescriptor* GetPanelDescriptor(const OUString& rsPanelId);
std::shared_ptr<DeckDescriptor> GetDeckDescriptor(const OUString& rsDeckId) const;
std::shared_ptr<PanelDescriptor> GetPanelDescriptor(const OUString& rsPanelId) const;

void UpdateModel(const css::uno::Reference<css::frame::XModel>& xModel);

Expand Down Expand Up @@ -96,10 +93,10 @@ public:
private:


typedef std::vector<DeckDescriptor> DeckContainer;
typedef std::vector<std::shared_ptr<DeckDescriptor>> DeckContainer;
DeckContainer maDecks;

typedef std::vector<PanelDescriptor> PanelContainer;
typedef std::vector<std::shared_ptr<PanelDescriptor>> PanelContainer;
PanelContainer maPanels;
mutable std::set<rtl::OUString> maProcessedApplications;

Expand All @@ -119,8 +116,8 @@ private:
const Context& rContext,
const css::uno::Reference<css::frame::XController>& rxController);

const DeckDescriptor* ImplGetDeckDescriptor(const OUString& rsDeckId) const;
const PanelDescriptor* ImplGetPanelDescriptor(const OUString& rsPanelId) const;
std::shared_ptr<DeckDescriptor> ImplGetDeckDescriptor(const OUString& rsDeckId) const;
std::shared_ptr<PanelDescriptor> ImplGetPanelDescriptor(const OUString& rsPanelId) const;
};

} } // end of namespace sfx2::sidebar
Expand Down
14 changes: 7 additions & 7 deletions include/sfx2/sidebar/TabBar.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public:
class DeckMenuData
{
public:
::rtl::OUString msDisplayName;
::rtl::OUString msDeckId;
OUString msDisplayName;
OUString msDeckId;
bool mbIsCurrentDeck;
bool mbIsActive;
bool mbIsEnabled;
Expand All @@ -67,7 +67,7 @@ public:
TabBar (
vcl::Window* pParentWindow,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
const ::std::function<void (const ::rtl::OUString&rsDeckId)>& rDeckActivationFunctor,
const ::std::function<void (const OUString& rsDeckId)>& rDeckActivationFunctor,
const PopupMenuProvider& rPopupMenuProvider,
SidebarController* rParentSidebarController);

Expand All @@ -82,9 +82,9 @@ public:

void SetDecks (
const ResourceManager::DeckContextDescriptorContainer& rDecks);
void HighlightDeck (const ::rtl::OUString& rsDeckId);
void HighlightDeck (const OUString& rsDeckId);
void RemoveDeckHighlight ();
const ::rtl::OUString GetDeckIdForIndex (const sal_Int32 nIndex) const;
const OUString GetDeckIdForIndex (const sal_Int32 nIndex) const;
void ToggleHideFlag (const sal_Int32 nIndex);
void RestoreHideFlags();

Expand All @@ -99,13 +99,13 @@ private:
DECL_LINK_TYPED(HandleClick, Button*, void);
VclPtr<RadioButton> mpButton;
OUString msDeckId;
::std::function<void (const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
::std::function<void (const OUString& rsDeckId)> maDeckActivationFunctor;
bool mbIsHidden;
bool mbIsHiddenByDefault;
};
typedef ::std::vector<Item> ItemContainer;
ItemContainer maItems;
const ::std::function<void (const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
const ::std::function<void (const OUString& rsDeckId)> maDeckActivationFunctor;
sal_Int32 mnMenuSeparatorY;
PopupMenuProvider maPopupMenuProvider;

Expand Down
Loading

0 comments on commit fce299f

Please sign in to comment.