[Libreoffice-commits] core.git: vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 15 14:25:26 UTC 2019


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

New commits:
commit 183206ee091c589a93b90a6a24cc4bdbe2d01062
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Sep 14 18:14:40 2019 +0100
Commit:     Caolán McNamara <caolanm at 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 <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at 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);


More information about the Libreoffice-commits mailing list