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 <thomas.hartmann@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Eike Ziller
2022-05-06 11:40:19 +02:00
parent aed87f257a
commit 2e0633907f

View File

@@ -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;