Commit ed02e7f3 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Git: Fix crash when returning to commit editor from diff

The crash happens on Linux/Xming. 2 subsequents calls to
slotRefreshCommitData occur, m_commitDataFetcher is released when the
first one is handled, and the second call dereferences NULL.

Change-Id: Ibc06fe5dd89b790ac84544f6842cbf345d118703
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 4dd20025
......@@ -229,9 +229,10 @@ void GitSubmitEditor::updateFileModel()
m_firstUpdate = false;
return;
}
if (m_workingDirectory.isEmpty())
GitSubmitEditorWidget *w = submitEditorWidget();
if (w->updateInProgress() || m_workingDirectory.isEmpty())
return;
submitEditorWidget()->setUpdateInProgress(true);
w->setUpdateInProgress(true);
resetCommitDataFetcher();
m_commitDataFetcher = new CommitDataFetcher(m_commitType, m_workingDirectory);
connect(m_commitDataFetcher, SIGNAL(finished(bool)), this, SLOT(commitDataRetrieved(bool)));
......@@ -244,10 +245,9 @@ void GitSubmitEditor::updateFileModel()
void GitSubmitEditor::commitDataRetrieved(bool success)
{
GitSubmitEditorWidget *w = submitEditorWidget();
w->setUpdateInProgress(false);
if (success) {
setCommitData(m_commitDataFetcher->commitData());
submitEditorWidget()->refreshLog(m_workingDirectory);
w->refreshLog(m_workingDirectory);
w->setEnabled(true);
} else {
// Nothing to commit left!
......@@ -257,6 +257,7 @@ void GitSubmitEditor::commitDataRetrieved(bool success)
}
m_commitDataFetcher->deleteLater();
m_commitDataFetcher = 0;
w->setUpdateInProgress(false);
}
GitSubmitEditorPanelData GitSubmitEditor::panelData() const
......
......@@ -583,6 +583,11 @@ void SubmitEditorWidget::setUpdateInProgress(bool value)
updateSubmitAction();
}
bool SubmitEditorWidget::updateInProgress() const
{
return d->m_updateInProgress;
}
QString SubmitEditorWidget::commitName() const
{
return tr("&Commit");
......
......@@ -105,6 +105,7 @@ public:
virtual bool canSubmit() const;
void setUpdateInProgress(bool value);
bool updateInProgress() const;
signals:
void diffSelected(const QList<int> &);
......
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