From 7f92c1af7deab5490b08e9a199b230babe372262 Mon Sep 17 00:00:00 2001 From: blacksun Date: Tue, 3 Oct 2017 08:54:58 +0000 Subject: [PATCH] Fix crash when user try to move a non movable item. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5060 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/diagramcontent.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sources/diagramcontent.cpp b/sources/diagramcontent.cpp index a887cc04f..6eff994ce 100644 --- a/sources/diagramcontent.cpp +++ b/sources/diagramcontent.cpp @@ -94,20 +94,25 @@ void DiagramContent::clear() int DiagramContent::removeNonMovableItems() { int count_ = 0; - - for(Element *elmt : m_elements) { + + const QSet elements_set = m_elements; + for(Element *elmt : elements_set) { if (!elmt->isMovable()) { m_elements.remove(elmt); ++count_; } } - for(DiagramImageItem *img : m_images) { + + const QSet images_set = m_images; + for(DiagramImageItem *img : images_set) { if (!img->isMovable()) { m_images.remove(img); ++count_; } } - for(QetShapeItem *shape : m_shapes) { + + const QSet shapes_set = m_shapes; + for(QetShapeItem *shape : shapes_set) { if (!shape->isMovable()) { m_shapes.remove(shape); ++count_;