forked from qt-creator/qt-creator
VcsBase, Git: Don't use queued connections to VcsCommand
Otherwise, the destructor of VcsCommand could have been executed in meantime (since it's invoked automatically after done()) and we might access invalid pointer to the command inside the done handler. Change-Id: I031e2281952451d4e01c47f437097a1e7bf8899f Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -1108,8 +1108,8 @@ void GitClient::status(const FilePath &workingDirectory) const
|
||||
{
|
||||
VcsOutputWindow::setRepository(workingDirectory);
|
||||
VcsCommand *command = vcsExec(workingDirectory, {"status", "-u"}, nullptr, true);
|
||||
connect(command, &VcsCommand::done, VcsOutputWindow::instance(),
|
||||
&VcsOutputWindow::clearRepository, Qt::QueuedConnection);
|
||||
connect(command, &VcsCommand::done,
|
||||
VcsOutputWindow::instance(), &VcsOutputWindow::clearRepository);
|
||||
}
|
||||
|
||||
static QStringList normalLogArguments()
|
||||
@@ -3113,7 +3113,7 @@ void GitClient::pull(const FilePath &workingDirectory, bool rebase)
|
||||
connect(command, &VcsCommand::done, this, [this, workingDirectory, command] {
|
||||
if (command->result() == ProcessResult::FinishedWithSuccess)
|
||||
updateSubmodulesIfNeeded(workingDirectory, true);
|
||||
}, Qt::QueuedConnection);
|
||||
});
|
||||
}
|
||||
|
||||
void GitClient::synchronousAbortCommand(const FilePath &workingDir, const QString &abortCommand)
|
||||
|
@@ -420,7 +420,7 @@ void VcsBaseClient::revertFile(const FilePath &workingDir,
|
||||
connect(cmd, &VcsCommand::done, this, [this, files, cmd] {
|
||||
if (cmd->result() == ProcessResult::FinishedWithSuccess)
|
||||
emit changed(files);
|
||||
}, Qt::QueuedConnection);
|
||||
});
|
||||
enqueueJob(cmd, args);
|
||||
}
|
||||
|
||||
@@ -436,7 +436,7 @@ void VcsBaseClient::revertAll(const FilePath &workingDir,
|
||||
connect(cmd, &VcsCommand::done, this, [this, files, cmd] {
|
||||
if (cmd->result() == ProcessResult::FinishedWithSuccess)
|
||||
emit changed(files);
|
||||
}, Qt::QueuedConnection);
|
||||
});
|
||||
enqueueJob(createCommand(workingDir), args);
|
||||
}
|
||||
|
||||
@@ -448,8 +448,7 @@ void VcsBaseClient::status(const FilePath &workingDir,
|
||||
args << extraOptions << file;
|
||||
VcsOutputWindow::setRepository(workingDir);
|
||||
VcsCommand *cmd = createCommand(workingDir, nullptr, VcsWindowOutputBind);
|
||||
connect(cmd, &VcsCommand::done, VcsOutputWindow::instance(), &VcsOutputWindow::clearRepository,
|
||||
Qt::QueuedConnection);
|
||||
connect(cmd, &VcsCommand::done, VcsOutputWindow::instance(), &VcsOutputWindow::clearRepository);
|
||||
enqueueJob(cmd, args);
|
||||
}
|
||||
|
||||
@@ -535,7 +534,7 @@ void VcsBaseClient::update(const FilePath &repositoryRoot, const QString &revisi
|
||||
connect(cmd, &VcsCommand::done, this, [this, repositoryRoot, cmd] {
|
||||
if (cmd->result() == ProcessResult::FinishedWithSuccess)
|
||||
emit changed(repositoryRoot.toString());
|
||||
}, Qt::QueuedConnection);
|
||||
});
|
||||
enqueueJob(cmd, args);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user