r22496 by jghali - #15278: Incorrect use of iterator after erasing element

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 29 13:45:33 UTC 2018


Author: jghali
Date: Sun Apr 29 13:45:33 2018
New Revision: 22496

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22496
Log:
#15278: Incorrect use of iterator after erasing element

Modified:
    trunk/Scribus/scribus/third_party/lib2geom/quadtree.cpp

Modified: trunk/Scribus/scribus/third_party/lib2geom/quadtree.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22496&path=/trunk/Scribus/scribus/third_party/lib2geom/quadtree.cpp
==============================================================================
--- trunk/Scribus/scribus/third_party/lib2geom/quadtree.cpp	(original)
+++ trunk/Scribus/scribus/third_party/lib2geom/quadtree.cpp	Sun Apr 29 13:45:33 2018
@@ -105,14 +105,15 @@
     }
     q->data.push_back(shape);
 }
+
 void QuadTree::erase(Quad *q, int shape) {
-    for(Quad::iterator i = q->data.begin();  i != q->data.end(); i++) {
+    Quad::iterator i = q->data.begin();
+    while(i != q->data.end()) {
         if(*i == shape) {
-            q->data.erase(i);
-            if(q->data.empty()) {
-
-            }
+            i = q->data.erase(i);
+            continue;
         }
+        i++;
     }
     return;
 }




More information about the scribus-commit mailing list