diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-06-03 14:04:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-06-03 15:39:34 +0100 |
commit | 89d38b8e0201861edbdad826e28f993aba8786be (patch) | |
tree | 99dcdbdf118cc1ba50e017e8456587641faf061a /include | |
parent | 97c62e9c9a589d15a8ac05ad949857503ac7e7f4 (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
(cherry picked from commit fce299fc64fcfe5280966631613edda7e6031c16)
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/sidebar/ResourceManager.hxx | 15 | ||||
-rw-r--r-- | include/sfx2/sidebar/TabBar.hxx | 14 |
2 files changed, 13 insertions, 16 deletions
diff --git a/include/sfx2/sidebar/ResourceManager.hxx b/include/sfx2/sidebar/ResourceManager.hxx index 3cf0df998333..c5456525f34d 100644 --- a/include/sfx2/sidebar/ResourceManager.hxx +++ b/include/sfx2/sidebar/ResourceManager.hxx @@ -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); @@ -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; @@ -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 diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx index 01158960f49a..5a8c0cdeca39 100644 --- a/include/sfx2/sidebar/TabBar.hxx +++ b/include/sfx2/sidebar/TabBar.hxx @@ -55,8 +55,8 @@ public: class DeckMenuData { public: - ::rtl::OUString msDisplayName; - ::rtl::OUString msDeckId; + OUString msDisplayName; + OUString msDeckId; bool mbIsCurrentDeck; bool mbIsActive; bool mbIsEnabled; @@ -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); @@ -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(); @@ -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; |