aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-04-05 10:49:10 +0300
committerAqua-sama <aqua@iserlohn-fortress.net>2020-04-17 18:27:20 +0300
commit78e4a0aa136e78bdb71c81f5931792b9c16d12e7 (patch)
tree7b70292ee30f4e351688f43d85c376652785291d /src
parentAdd args.wrap (diff)
downloadsmolbote-78e4a0aa136e78bdb71c81f5931792b9c16d12e7.tar.xz
MainWindow: disconnect signals during closeEventfix-segfault-at-quit
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow/mainwindow.cpp7
-rw-r--r--src/mainwindow/mainwindow.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp
index e16f34f..c54c8e3 100644
--- a/src/mainwindow/mainwindow.cpp
+++ b/src/mainwindow/mainwindow.cpp
@@ -177,10 +177,14 @@ void MainWindow::setCurrentSubWindow(SubWindow *subwindow)
setWindowTitle(QString("[%1] - %2").arg(subwindow->windowTitle(), defaultWindowTitle));
// connect signlas
+ disconnect(windowTitleConnection);
disconnect(viewChangedConnection);
disconnect(statusBarConnection);
setView(subwindow->currentView());
+ windowTitleConnection = connect(subwindow, &SubWindow::windowTitleChanged, this, [this](const QString &title) {
+ setWindowTitle(QString("[%1] - %2").arg(title, defaultWindowTitle));
+ });
viewChangedConnection = connect(subwindow, &SubWindow::currentViewChanged, this, &MainWindow::setView);
statusBarConnection = connect(subwindow, &SubWindow::showStatusMessage, statusBar(), &QStatusBar::showMessage);
}
@@ -201,5 +205,8 @@ void MainWindow::closeEvent(QCloseEvent *event)
return;
}
}
+ disconnect(windowTitleConnection);
+ disconnect(viewChangedConnection);
+ disconnect(statusBarConnection);
event->accept();
}
diff --git a/src/mainwindow/mainwindow.h b/src/mainwindow/mainwindow.h
index 2b9f82b..bec2cdd 100644
--- a/src/mainwindow/mainwindow.h
+++ b/src/mainwindow/mainwindow.h
@@ -86,6 +86,7 @@ private:
QVector<SubWindow *> m_subwindows;
+ QMetaObject::Connection windowTitleConnection;
QMetaObject::Connection viewChangedConnection;
QMetaObject::Connection statusBarConnection;
};