Fix crash when use Windows/Close option.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-01-06 12:09:06 +02:00
parent fdd7f6c2a3
commit 231780d35e

View File

@ -2884,6 +2884,7 @@ void MainWindow::Clear()
qCDebug(vMainWindow, "Unlocked pattern file."); qCDebug(vMainWindow, "Unlocked pattern file.");
ActionDraw(true); ActionDraw(true);
qCDebug(vMainWindow, "Returned to Draw mode."); qCDebug(vMainWindow, "Returned to Draw mode.");
setCurrentFile(QString());// Keep before cleaning a pattern data to prevent a crash
pattern->Clear(); pattern->Clear();
qCDebug(vMainWindow, "Clearing pattern."); qCDebug(vMainWindow, "Clearing pattern.");
if (not qApp->GetPPath().isEmpty() && not doc->MPath().isEmpty()) if (not qApp->GetPPath().isEmpty() && not doc->MPath().isEmpty())
@ -2891,7 +2892,6 @@ void MainWindow::Clear()
watcher->removePath(AbsoluteMPath(qApp->GetPPath(), doc->MPath())); watcher->removePath(AbsoluteMPath(qApp->GetPPath(), doc->MPath()));
} }
doc->clear(); doc->clear();
setCurrentFile(QString());
qCDebug(vMainWindow, "Clearing scenes."); qCDebug(vMainWindow, "Clearing scenes.");
sceneDraw->clear(); sceneDraw->clear();
sceneDetails->clear(); sceneDetails->clear();