vcl/source/app/salvtables.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 183206ee091c589a93b90a6a24cc4bdbe2d01062
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Sep 14 18:14:40 2019 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Sep 15 16:24:29 2019 +0200

    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 <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 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);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to