forked from qt-creator/qt-creator
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: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
4dd200259f
commit
ed02e7f3c5
@@ -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> &);
|
||||
|
||||
Reference in New Issue
Block a user