r22497 by jghali - #15278: Incorrect use of iterator after erasing element
scribus-commit
scribus-commit at lists.scribus.net
Sun Apr 29 13:46:13 UTC 2018
Author: jghali
Date: Sun Apr 29 13:46:13 2018
New Revision: 22497
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22497
Log:
#15278: Incorrect use of iterator after erasing element
Modified:
branches/Version14x/Scribus/scribus/plugins/tools/2geomtools/lib2geom/quadtree.cpp
Modified: branches/Version14x/Scribus/scribus/plugins/tools/2geomtools/lib2geom/quadtree.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22497&path=/branches/Version14x/Scribus/scribus/plugins/tools/2geomtools/lib2geom/quadtree.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/tools/2geomtools/lib2geom/quadtree.cpp (original)
+++ branches/Version14x/Scribus/scribus/plugins/tools/2geomtools/lib2geom/quadtree.cpp Sun Apr 29 13:46:13 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