Commit 72c33cba authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Git: Fix potential heap use after free

Closing the dialog before the process terminates might lead to this.

Task-number: QTCREATORBUG-13075
Change-Id: I3b6ffcca010eb356b14d87f2a7d62090c158faba
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 3f3554eb
......@@ -94,8 +94,8 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, Co
ChangeSelectionDialog::~ChangeSelectionDialog()
{
terminateProcess();
delete m_ui;
delete m_process;
}
QString ChangeSelectionDialog::change() const
......@@ -197,6 +197,16 @@ void ChangeSelectionDialog::enableButtons(bool b)
m_ui->checkoutButton->setEnabled(b);
}
void ChangeSelectionDialog::terminateProcess()
{
if (!m_process)
return;
m_process->kill();
m_process->waitForFinished();
delete m_process;
m_process = 0;
}
void ChangeSelectionDialog::recalculateCompletion()
{
const QString workingDir = workingDirectory();
......@@ -219,12 +229,7 @@ void ChangeSelectionDialog::recalculateCompletion()
void ChangeSelectionDialog::recalculateDetails()
{
if (m_process) {
m_process->kill();
m_process->waitForFinished();
delete m_process;
m_process = 0;
}
terminateProcess();
enableButtons(false);
const QString workingDir = workingDirectory();
......
......@@ -85,6 +85,7 @@ private slots:
private:
void enableButtons(bool b);
void terminateProcess();
Ui::ChangeSelectionDialog *m_ui;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment