sw/source/ui/misc/bookmark.cxx |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit ccb979c53931ab3f4712d0a3f7d0f844dcfc5c5d
Author: Jan-Marek Glogowski <glo...@fbihome.de>
Date:   Tue Sep 20 17:00:44 2016 +0200

    tdf#101359 Really walk the document mark list
    
    In both functions we want to walk the current mark list and
    act on the MarkType::BOOKMARK, so mimic the behaviour of
    PopulateTable in HaveBookmarksChanged.
    
    My previous commit 96454829f7dc6480f9ddd4262bc03d5ccabadea4
    is broken and just works out of luck...
    
    Change-Id: I2f53b775208cad7e83992d1ae4fb67a41588cb92

diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index b932883..fdf0262 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -249,15 +249,18 @@ bool SwInsertBookmarkDlg::HaveBookmarksChanged()
     if (pMarkAccess->getBookmarksCount() != m_nLastBookmarksCount)
         return true;
 
-    IDocumentMarkAccess::const_iterator_t ppBookmark = 
pMarkAccess->getBookmarksBegin();
-    for (std::pair<sw::mark::IMark*,OUString> & aTableBookmark : 
aTableBookmarks)
+    std::vector<std::pair<sw::mark::IMark*, OUString>>::const_iterator 
aListIter = aTableBookmarks.begin();
+    for (IDocumentMarkAccess::const_iterator_t ppBookmark = 
pMarkAccess->getBookmarksBegin();
+         ppBookmark != pMarkAccess->getBookmarksEnd(); ++ppBookmark)
     {
         if (IDocumentMarkAccess::MarkType::BOOKMARK == 
IDocumentMarkAccess::GetType(**ppBookmark))
         {
-            if (aTableBookmark.first != ppBookmark->get() ||
-                aTableBookmark.second != ppBookmark->get()->GetName())
+            if (aListIter == aTableBookmarks.end())
                 return true;
-            ++ppBookmark;
+            if (aListIter->first != ppBookmark->get() ||
+                aListIter->second != ppBookmark->get()->GetName())
+                return true;
+            ++aListIter;
         }
     }
     return false;
@@ -267,6 +270,7 @@ void SwInsertBookmarkDlg::PopulateTable()
 {
     aTableBookmarks.clear();
     m_pBookmarksBox->Clear();
+
     IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
     for (IDocumentMarkAccess::const_iterator_t ppBookmark = 
pMarkAccess->getBookmarksBegin();
          ppBookmark != pMarkAccess->getBookmarksEnd(); ++ppBookmark)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to