From 8d333cbf1ba6ee1279f41ff72987450ace84183e Mon Sep 17 00:00:00 2001 From: blacksun Date: Mon, 9 Oct 2017 16:05:19 +0000 Subject: [PATCH] Set the ItemIndexMethod of scene to NoIndex, according to some forum (Adress of forum are in the cpp file of this comit) they can be the sources of the crash occured by the conductor and shape "guost". git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5073 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/diagram.cpp | 7 +++++++ sources/editor/elementscene.cpp | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 12fd37a92..6a8c86568 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -64,6 +64,13 @@ Diagram::Diagram(QETProject *project) : m_freeze_new_elements (false), m_freeze_new_conductors_ (false) { + setItemIndexMethod(QGraphicsScene::NoIndex); + //Set to no index, because they can be the source of the crash with conductor and shape ghost. + //https://forum.qt.io/topic/71316/qgraphicsscenefinditembsptreevisitor-visit-crashes-due-to-an-obsolete-paintevent-after-qgraphicsscene-removeitem + //https://stackoverflow.com/questions/38458830/crash-after-qgraphicssceneremoveitem-with-custom-item-class + //http://www.qtcentre.org/archive/index.php/t-33730.html + //http://tech-artists.org/t/qt-properly-removing-qgraphicitems/3063 + setProject(project); qgi_manager_ = new QGIManager(this); setBackgroundBrush(Qt::white); diff --git a/sources/editor/elementscene.cpp b/sources/editor/elementscene.cpp index 9716c2e16..fbfc76d25 100644 --- a/sources/editor/elementscene.cpp +++ b/sources/editor/elementscene.cpp @@ -49,6 +49,13 @@ ElementScene::ElementScene(QETElementEditor *editor, QObject *parent) : m_qgi_manager(this), m_element_editor(editor) { + setItemIndexMethod(QGraphicsScene::NoIndex); + //Set to no index, because they can be the source of the crash with conductor and shape ghost. + //https://forum.qt.io/topic/71316/qgraphicsscenefinditembsptreevisitor-visit-crashes-due-to-an-obsolete-paintevent-after-qgraphicsscene-removeitem + //https://stackoverflow.com/questions/38458830/crash-after-qgraphicssceneremoveitem-with-custom-item-class + //http://www.qtcentre.org/archive/index.php/t-33730.html + //http://tech-artists.org/t/qt-properly-removing-qgraphicitems/3063 + m_behavior = Normal; setItemIndexMethod(NoIndex); setGrid(1, 1);