[qet] qet/qet: [4992] Fix crash. Close a project with a selected linkable element (master, slave, report) cause a crash |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4992
Author: blacksun
Date: 2017-07-20 14:40:30 +0200 (Thu, 20 Jul 2017)
Log Message:
-----------
Fix crash. Close a project with a selected linkable element (master, slave, report) cause a crash
Modified Paths:
--------------
trunk/sources/PropertiesEditor/propertieseditordockwidget.cpp
trunk/sources/diagram.cpp
trunk/sources/ui/diagrampropertieseditordockwidget.cpp
Modified: trunk/sources/PropertiesEditor/propertieseditordockwidget.cpp
===================================================================
--- trunk/sources/PropertiesEditor/propertieseditordockwidget.cpp 2017-07-20 12:35:02 UTC (rev 4991)
+++ trunk/sources/PropertiesEditor/propertieseditordockwidget.cpp 2017-07-20 12:40:30 UTC (rev 4992)
@@ -52,7 +52,7 @@
{
m_editor_list.removeOne(editor);
ui->m_main_vlayout->removeWidget(editor);
- editor->deleteLater();
+ delete editor;
}
m_editor_list.clear();
Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp 2017-07-20 12:35:02 UTC (rev 4991)
+++ trunk/sources/diagram.cpp 2017-07-20 12:40:30 UTC (rev 4992)
@@ -91,23 +91,28 @@
* @brief Diagram::~Diagram
* Destructor
*/
-Diagram::~Diagram() {
- // clear undo stack to prevent errors, because contains pointers to this diagram and is elements.
+Diagram::~Diagram()
+{
+ //First clear every selection to close an hypothetical editor
+ clearSelection();
+ // clear undo stack to prevent errors, because contains pointers to this diagram and is elements.
undoStack().clear();
- //delete of QGIManager, every elements he knows are removed
+ //delete of QGIManager, every elements he knows are removed
delete qgi_manager_;
- // remove of conductor setter
+ // remove of conductor setter
delete conductor_setter_;
- // delete of object for manage movement
+ // delete of object for manage movement
delete elements_mover_;
delete element_texts_mover_;
- if (m_event_interface) delete m_event_interface;
+ if (m_event_interface)
+ delete m_event_interface;
- // list removable items
+ // list removable items
QList<QGraphicsItem *> deletable_items;
- foreach(QGraphicsItem *qgi, items()) {
+ for(QGraphicsItem *qgi : items())
+ {
if (qgi -> parentItem()) continue;
if (qgraphicsitem_cast<Conductor *>(qgi)) continue;
deletable_items << qgi;
Modified: trunk/sources/ui/diagrampropertieseditordockwidget.cpp
===================================================================
--- trunk/sources/ui/diagrampropertieseditordockwidget.cpp 2017-07-20 12:35:02 UTC (rev 4991)
+++ trunk/sources/ui/diagrampropertieseditordockwidget.cpp 2017-07-20 12:40:30 UTC (rev 4992)
@@ -56,7 +56,7 @@
if (diagram)
{
m_diagram = diagram;
- connect(m_diagram, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()), Qt::QueuedConnection);
+ connect(m_diagram, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
connect(m_diagram, SIGNAL(destroyed()), this, SLOT(diagramWasDeleted()));
selectionChanged();
}