[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - svx/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 21 19:23:02 UTC 2019


 svx/source/dialog/srchdlg.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 611d7a2d07c6f2ee97bf3cec4b3b372bfb5b0f4c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Nov 18 13:44:46 2019 +0000
Commit:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
CommitDate: Thu Nov 21 20:21:56 2019 +0100

    rhbz#1773525 wrong elements removed from saved entries when limit hit
    
    Change-Id: Iaf8a012ffe927cbf38789e97b469d899e7cbf87b
    Reviewed-on: https://gerrit.libreoffice.org/83096
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 8952e347c7cb..ce298c60e494 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -1581,16 +1581,16 @@ void SvxSearchDialog::Remember_Impl( const OUString &rStr, bool _bSearch )
     if (std::find(pArr->begin(), pArr->end(), rStr) != pArr->end())
         return;
 
+    pArr->insert(pArr->begin(), rStr);
+    pListBox->insert_text(0, rStr);
+
     // delete oldest entry at maximum occupancy (ListBox and Array)
-    if(nRememberSize < pArr->size())
+    size_t nArrSize = pArr->size();
+    if (nArrSize > nRememberSize)
     {
-        pListBox->remove(static_cast<sal_uInt16>(nRememberSize - 1));
-        (*pArr)[nRememberSize - 1] = rStr;
-        pArr->erase(pArr->begin() + nRememberSize - 1);
+        pListBox->remove(nArrSize - 1);
+        pArr->erase(pArr->begin() + nArrSize - 1);
     }
-
-    pArr->insert(pArr->begin(), rStr);
-    pListBox->insert_text(0, rStr);
 }
 
 void SvxSearchDialog::TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool )


More information about the Libreoffice-commits mailing list