Git: Do not crash when closing creator after reverting all files in a commit

Keep the commit editor around and disable it instead of closing it. That stops
Qt Creator from closing the editor when bringing the commit editor to the
foreground to ask whether it should be closed.

Task-number: QTCREATORBUG-12099
Change-Id: I6927424675338f845f504cb6f630f05eaf8ad49f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Tobias Hunger
2014-04-29 15:39:26 +02:00
parent 93cdde544c
commit fe37b2788b
2 changed files with 6 additions and 2 deletions

View File

@@ -179,12 +179,16 @@ void GitSubmitEditor::updateFileModel()
QString errorMessage, commitTemplate; QString errorMessage, commitTemplate;
CommitData data(m_commitType); CommitData data(m_commitType);
if (client->getCommitData(m_workingDirectory, &commitTemplate, data, &errorMessage)) { if (client->getCommitData(m_workingDirectory, &commitTemplate, data, &errorMessage)) {
m_forceClose = false;
setCommitData(data); setCommitData(data);
submitEditorWidget()->refreshLog(m_workingDirectory); submitEditorWidget()->refreshLog(m_workingDirectory);
widget()->setEnabled(true);
} else { } else {
// Nothing to commit left!
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage); VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
m_forceClose = true; m_forceClose = true;
Core::EditorManager::closeEditor(this); m_model->clear();
widget()->setEnabled(false);
} }
} }

View File

@@ -53,7 +53,7 @@ public:
void setCommitData(const CommitData &); void setCommitData(const CommitData &);
GitSubmitEditorPanelData panelData() const; GitSubmitEditorPanelData panelData() const;
bool forceClose() const { return m_forceClose; } bool forceClose() { updateFileModel(); return m_forceClose; }
CommitType commitType() const { return m_commitType; } CommitType commitType() const { return m_commitType; }
QString amendSHA1() const; QString amendSHA1() const;