[gnote/gnome-3-34] Fix possible crash when removing tags



commit f8e73225b2d41d4948f564852819c5c9e6b85141
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Tue Oct 8 23:00:46 2019 +0300

    Fix possible crash when removing tags

 src/notebase.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/notebase.cpp b/src/notebase.cpp
index 89331313..0f0904a7 100644
--- a/src/notebase.cpp
+++ b/src/notebase.cpp
@@ -216,8 +216,9 @@ void NoteBase::handle_link_rename(const Glib::ustring &, const Ptr &, bool)
 void NoteBase::delete_note()
 {
   // Remove the note from all the tags
-  for(NoteData::TagMap::const_iterator iter = data_synchronizer().data().tags().begin();
-      iter != data_synchronizer().data().tags().end(); ++iter) {
+  // remove_tag modifies map, so always iterate from start
+  NoteData::TagMap & thetags(data_synchronizer().data().tags());
+  for(NoteData::TagMap::const_iterator iter = thetags.begin(); iter != thetags.end(); iter = 
thetags.begin()) {
     remove_tag(iter->second);
   }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]