aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-07-01 14:43:19 +0200
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-07-01 14:43:19 +0200
commit2db0208ed333e0bf232e396c1789085781f50d66 (patch)
tree80cebfcdeb0ae83db4379fcc8d6262524173aec5
parent215b6b79c3ecc9ca0954710c0dd2a218d4c015fb (diff)
downloadqtmips-2db0208ed333e0bf232e396c1789085781f50d66.tar.gz
qtmips-2db0208ed333e0bf232e396c1789085781f50d66.tar.bz2
qtmips-2db0208ed333e0bf232e396c1789085781f50d66.zip
Correct order of operations during editor close.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
-rw-r--r--qtmips_gui/mainwindow.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/qtmips_gui/mainwindow.cpp b/qtmips_gui/mainwindow.cpp
index 4ad3b0f..241a623 100644
--- a/qtmips_gui/mainwindow.cpp
+++ b/qtmips_gui/mainwindow.cpp
@@ -533,9 +533,10 @@ void MainWindow::save_source() {
void MainWindow::close_source() {
if (current_srceditor == nullptr)
return;
- int idx = central_window->indexOf(current_srceditor);
+ SrcEditor *editor = current_srceditor;
+ setCurrentSrcEditor(nullptr);
+ int idx = central_window->indexOf(editor);
if (idx >= 0)
central_window->removeTab(idx);
- delete current_srceditor;
- current_srceditor = nullptr;
+ delete editor;
}