Git: Do not re-use diff controller

When the controller is re-used, the file list is not refreshed.

This doesn't cause a leak, since DiffEditorDocument::setController
deletes the previous controller if already set.

Task-number: QTCREATORBUG-17815
Change-Id: Ic30ef15f9df4fa1cc196dcd175e2df44a88b2f89
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Orgad Shaneh
2017-03-02 08:08:56 +02:00
committed by Orgad Shaneh
parent 13492fea66
commit e575a60508

View File

@@ -722,16 +722,13 @@ void GitClient::requestReload(const QString &documentId, const QString &source,
IDocument *document = DiffEditorController::findOrCreateDocument(documentId, title);
QTC_ASSERT(document, return);
DiffEditorController *controller = DiffEditorController::controller(document);
if (!controller) {
controller = factory(document);
QTC_ASSERT(controller, return);
DiffEditorController *controller = factory(document);
QTC_ASSERT(controller, return);
connect(controller, &DiffEditorController::chunkActionsRequested,
this, &GitClient::slotChunkActionsRequested, Qt::DirectConnection);
connect(controller, &DiffEditorController::requestInformationForCommit,
this, &GitClient::branchesForCommit);
}
connect(controller, &DiffEditorController::chunkActionsRequested,
this, &GitClient::slotChunkActionsRequested, Qt::DirectConnection);
connect(controller, &DiffEditorController::requestInformationForCommit,
this, &GitClient::branchesForCommit);
VcsBasePlugin::setSource(document, sourceCopy);
EditorManager::activateEditorForDocument(document);