[qet] qet/qet: [5060] Fix crash when user try to move a non movable item.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 5060
Author:   blacksun
Date:     2017-10-03 10:54:58 +0200 (Tue, 03 Oct 2017)
Log Message:
-----------
Fix crash when user try to move a non movable item.

Modified Paths:
--------------
    trunk/sources/diagramcontent.cpp

Modified: trunk/sources/diagramcontent.cpp
===================================================================
--- trunk/sources/diagramcontent.cpp	2017-10-02 16:59:53 UTC (rev 5059)
+++ trunk/sources/diagramcontent.cpp	2017-10-03 08:54:58 UTC (rev 5060)
@@ -94,20 +94,25 @@
 int DiagramContent::removeNonMovableItems()
 {
 	int count_ = 0;
-
-	for(Element *elmt : m_elements) {
+	
+	const QSet<Element *> elements_set = m_elements;
+	for(Element *elmt : elements_set) {
 		if (!elmt->isMovable()) {
 			m_elements.remove(elmt);
 			++count_;
 		}
 	}
-	for(DiagramImageItem *img : m_images) {
+	
+	const QSet<DiagramImageItem *> images_set = m_images;
+	for(DiagramImageItem *img : images_set) {
 		if (!img->isMovable()) {
 			m_images.remove(img);
 			++count_;
 		}
 	}
-	for(QetShapeItem *shape : m_shapes) {
+	
+	const QSet<QetShapeItem *> shapes_set = m_shapes;
+	for(QetShapeItem *shape : shapes_set) {
 		if (!shape->isMovable()) {
 			m_shapes.remove(shape);
 			++count_;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/