vcl/source/app/salvtables.cxx | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
New commits: commit c1bd1389b65fc959607b92265d12d8609b707cc4 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Dec 6 11:17:51 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Dec 6 17:10:33 2019 +0100 remove the added pages grid and tabpage when remove page called Change-Id: Id2df8e320335e2578c2a3f879b1bb6612a77ca8b Reviewed-on: https://gerrit.libreoffice.org/84636 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index a338f9465ff3..ae1aaa090823 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -2260,8 +2260,7 @@ class SalInstanceNotebook : public SalInstanceContainer, public virtual weld::No private: VclPtr<TabControl> m_xNotebook; mutable std::vector<std::unique_ptr<SalInstanceContainer>> m_aPages; - std::vector<VclPtr<TabPage>> m_aAddedPages; - std::vector<VclPtr<VclGrid>> m_aAddedGrids; + std::map<OString, std::pair<VclPtr<TabPage>, VclPtr<VclGrid>>> m_aAddedPages; DECL_LINK(DeactivatePageHdl, TabControl*, bool); DECL_LINK(ActivatePageHdl, TabControl*, void); @@ -2321,9 +2320,18 @@ public: sal_uInt16 nPageIndex = m_xNotebook->GetPagePos(nPageId); if (nPageIndex == TAB_PAGE_NOTFOUND) return; + m_xNotebook->RemovePage(nPageId); if (nPageIndex < m_aPages.size()) m_aPages.erase(m_aPages.begin() + nPageIndex); + + auto iter = m_aAddedPages.find(rIdent); + if (iter != m_aAddedPages.end()) + { + iter->second.second.disposeAndClear(); + iter->second.first.disposeAndClear(); + m_aAddedPages.erase(iter); + } } virtual void append_page(const OString& rIdent, const OUString& rLabel) override @@ -2340,8 +2348,7 @@ public: xGrid->Show(); m_xNotebook->SetTabPage(nNewPageId, xPage); m_xNotebook->SetPageName(nNewPageId, rIdent); - m_aAddedPages.push_back(xPage); - m_aAddedGrids.push_back(xGrid); + m_aAddedPages.try_emplace(rIdent, xPage, xGrid); } virtual int get_n_pages() const override @@ -2361,10 +2368,11 @@ public: virtual ~SalInstanceNotebook() override { - for (auto &rGrid : m_aAddedGrids) - rGrid.disposeAndClear(); - for (auto &rPage : m_aAddedPages) - rPage.disposeAndClear(); + for (auto &rItem : m_aAddedPages) + { + rItem.second.second.disposeAndClear(); + rItem.second.first.disposeAndClear(); + } m_xNotebook->SetActivatePageHdl(Link<TabControl*,void>()); m_xNotebook->SetDeactivatePageHdl(Link<TabControl*,bool>()); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits