From 6f665c26a5bdb940983c5bf07ce3c0155bf29842 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Sat, 20 Jan 2024 18:21:52 +0100 Subject: [PATCH] Git: InstantBlame: Init m_cursorPositionChangedTimer in ctor Needs to be done only once, and fixes a dangling pointer if setup() was called twice. Change-Id: I02722daf5dffdfb2d4bb70de77436eb8d930806d Reviewed-by: Orgad Shaneh --- src/plugins/git/instantblame.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/git/instantblame.cpp b/src/plugins/git/instantblame.cpp index c1cff960a59..df9d913c796 100644 --- a/src/plugins/git/instantblame.cpp +++ b/src/plugins/git/instantblame.cpp @@ -104,14 +104,14 @@ QString BlameMark::toolTipText(const CommitInfo &info) const InstantBlame::InstantBlame() { m_codec = gitClient().defaultCommitEncoding(); + m_cursorPositionChangedTimer = new QTimer(this); + m_cursorPositionChangedTimer->setSingleShot(true); + connect(m_cursorPositionChangedTimer, &QTimer::timeout, this, &InstantBlame::perform); } void InstantBlame::setup() { qCDebug(log) << "Setup"; - m_cursorPositionChangedTimer = new QTimer(this); - m_cursorPositionChangedTimer->setSingleShot(true); - connect(m_cursorPositionChangedTimer, &QTimer::timeout, this, &InstantBlame::perform); auto setupBlameForEditor = [this](Core::IEditor *editor) { if (!editor) {