From eb69ecd3c7599c68da7f67aa8c50b15845b2c5ed Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Wed, 11 Aug 2021 17:27:22 -0500 Subject: [PATCH] EditorManager: Do not add Watcher for documents with no file name Currently EditorManagerPrivate::addEditor() adds a Watcher for any document unless it's set as temporary. However some documents may have no associated file name (for example, VCS editors content), yet not explicitly created as temporary. This eventually leads to an empty file name in the list of paths to watch. Thus this triggers a check-warning: QFileSystemWatcher::addPaths: list is empty Since IDocument::filePath() in general is not guaranteed to be non-empty, then it makes sense to add a Watcher only for documents with an associated file name. Change-Id: Ie7eacb7f90af399e6b1a837e1644bd5a1fe99212 Reviewed-by: hjk Reviewed-by: Eike Ziller --- src/plugins/coreplugin/editormanager/editormanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 7204226d042..c66101c0bb0 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1448,7 +1448,7 @@ void EditorManagerPrivate::addEditor(IEditor *editor) DocumentModelPrivate::addEditor(editor, &isNewDocument); if (isNewDocument) { IDocument *document = editor->document(); - const bool isTemporary = document->isTemporary(); + const bool isTemporary = (document->isTemporary() || document->filePath().isEmpty()); const bool addWatcher = !isTemporary; DocumentManager::addDocument(document, addWatcher); if (!isTemporary)