aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_gui')
-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;
}