summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-12-06 11:17:51 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-12-06 17:10:33 +0100
commitc1bd1389b65fc959607b92265d12d8609b707cc4 (patch)
tree4dce66bac23523eeac341bed762e94092f73cc04 /vcl
parent766ce853d18da813e8d435776f462470cd072538 (diff)
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 <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/salvtables.cxx24
1 files changed, 16 insertions, 8 deletions
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>());
}