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 <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2024-01-20 18:21:52 +01:00
committed by André Hartmann
parent 7493b3a630
commit 6f665c26a5

View File

@@ -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) {