From fe37b2788b83b0baa9cd506fdea4f27d214bf9f0 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 29 Apr 2014 15:39:26 +0200 Subject: 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 Reviewed-by: Tobias Hunger --- src/plugins/git/gitsubmiteditor.cpp | 6 +++++- src/plugins/git/gitsubmiteditor.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/git/gitsubmiteditor.cpp b/src/plugins/git/gitsubmiteditor.cpp index 7857171768..631094d803 100644 --- a/src/plugins/git/gitsubmiteditor.cpp +++ b/src/plugins/git/gitsubmiteditor.cpp @@ -179,12 +179,16 @@ void GitSubmitEditor::updateFileModel() QString errorMessage, commitTemplate; CommitData data(m_commitType); if (client->getCommitData(m_workingDirectory, &commitTemplate, data, &errorMessage)) { + m_forceClose = false; setCommitData(data); submitEditorWidget()->refreshLog(m_workingDirectory); + widget()->setEnabled(true); } else { + // Nothing to commit left! VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage); m_forceClose = true; - Core::EditorManager::closeEditor(this); + m_model->clear(); + widget()->setEnabled(false); } } diff --git a/src/plugins/git/gitsubmiteditor.h b/src/plugins/git/gitsubmiteditor.h index e2e093cfe2..75b2cf5e83 100644 --- a/src/plugins/git/gitsubmiteditor.h +++ b/src/plugins/git/gitsubmiteditor.h @@ -53,7 +53,7 @@ public: void setCommitData(const CommitData &); GitSubmitEditorPanelData panelData() const; - bool forceClose() const { return m_forceClose; } + bool forceClose() { updateFileModel(); return m_forceClose; } CommitType commitType() const { return m_commitType; } QString amendSHA1() const; -- cgit v1.2.1