From 2e0633907f3dbb3035bc7204194d2c20c7d42796 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 6 May 2022 11:40:19 +0200 Subject: [PATCH] VCS: Fix possible crash on shutdown Similar to how it is done for the WindowTitleAdditionHandler and SessionTitleHandler. Fixes: QTCREATORBUG-27048 Change-Id: Ic8c140b99c7c6edbc43bed5f1b9275b4af5ce831 Reviewed-by: Thomas Hartmann Reviewed-by: Orgad Shaneh Reviewed-by: --- src/plugins/vcsbase/vcsbaseplugin.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index b058600d0b2..b371c8b2f64 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -197,6 +197,7 @@ class StateListener : public QObject public: explicit StateListener(QObject *parent); + ~StateListener(); static QString windowTitleVcsTopic(const QString &filePath); @@ -221,10 +222,14 @@ StateListener::StateListener(QObject *parent) : QObject(parent) connect(SessionManager::instance(), &SessionManager::startupProjectChanged, this, &StateListener::slotStateChanged); - EditorManager::setWindowTitleVcsTopicHandler(&StateListener::windowTitleVcsTopic); } +StateListener::~StateListener() +{ + EditorManager::setWindowTitleVcsTopicHandler({}); +} + QString StateListener::windowTitleVcsTopic(const QString &filePath) { FilePath searchPath;