summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-09-14 18:14:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-09-15 16:24:29 +0200
commit183206ee091c589a93b90a6a24cc4bdbe2d01062 (patch)
tree88f6821d67d75ed6da6501575322438af76280d8 /vcl
parent4cf9bb10945aaad487c756c8f282d03b9eea89ae (diff)
base new page id off current last page id
So when appending a page, not originally in the .ui, we use an id of +1 of the final id, rather than an id equal to the number of pages. That way we don't end up with duplicate ids if there was a page removed before appending another one Change-Id: I150f479112198bc26fc2dc143fa4622f5e0de713 Reviewed-on: https://gerrit.libreoffice.org/78911 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.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 601fe9c04958..f4bc9708018b 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2020,8 +2020,9 @@ public:
virtual void append_page(const OString& rIdent, const OUString& rLabel) override
{
- sal_uInt16 nNewPageCount = m_xNotebook->GetPageCount() + 1;
- sal_uInt16 nNewPageId = nNewPageCount;
+ sal_uInt16 nPageCount = m_xNotebook->GetPageCount();
+ sal_uInt16 nLastPageId = nPageCount ? m_xNotebook->GetPageId(nPageCount - 1) : 0;
+ sal_uInt16 nNewPageId = nLastPageId + 1;
m_xNotebook->InsertPage(nNewPageId, rLabel);
VclPtrInstance<TabPage> xPage(m_xNotebook);
VclPtrInstance<VclGrid> xGrid(xPage);