forked from qt-creator/qt-creator
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 <hjk@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user