mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Fix crash when close project
At time of closing project, if a master element(may be every linkable element) is selected and the editor dock display a lot of available slave, qet crash.
This commit is contained in:
@@ -1932,17 +1932,26 @@ void QETDiagramEditor::activateProject(ProjectView *project_view) {
|
||||
}
|
||||
|
||||
/**
|
||||
Gere la fermeture d'une ProjectView
|
||||
@param project_view ProjectView fermee
|
||||
*/
|
||||
void QETDiagramEditor::projectWasClosed(ProjectView *project_view) {
|
||||
* @brief QETDiagramEditor::projectWasClosed
|
||||
* Manage the close of a project.
|
||||
* @param project_view
|
||||
*/
|
||||
void QETDiagramEditor::projectWasClosed(ProjectView *project_view)
|
||||
{
|
||||
QETProject *project = project_view -> project();
|
||||
if (project) {
|
||||
if (project)
|
||||
{
|
||||
pa -> elementsPanel().projectWasClosed(project);
|
||||
m_element_collection_widget->removeProject(project);
|
||||
undo_group.removeStack(project -> undoStack());
|
||||
QETApp::unregisterProject(project);
|
||||
}
|
||||
|
||||
//When project is closed, a lot of signal are emited, notably if there is an item selected in a diagram.
|
||||
//In some special case, since signal/slot connection can be direct or queued, some signal are handled after QObject is deleted, and crash qet
|
||||
//notably in the function Diagram::elements when she call items() (I don't know exactly why).
|
||||
//set nullptr to "m_selection_properties_editor->setDiagram()" fix this crash
|
||||
m_selection_properties_editor->setDiagram(nullptr);
|
||||
project_view -> deleteLater();
|
||||
project -> deleteLater();
|
||||
}
|
||||
@@ -2147,7 +2156,7 @@ void QETDiagramEditor::removeDiagramFromProject() {
|
||||
*/
|
||||
void QETDiagramEditor::diagramWasAdded(DiagramView *dv)
|
||||
{
|
||||
connect(dv, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
|
||||
connect(dv->diagram(), &QGraphicsScene::selectionChanged, this, &QETDiagramEditor::selectionChanged, Qt::DirectConnection);
|
||||
connect(dv, SIGNAL(modeChanged()), this, SLOT(slot_updateModeActions()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user