Don't try to remove watched files if none exist
If we try to remove watched files but we couldn't actually watch any earlier, we'd get a Qt warning message: QtWarningMsg: QFileSystemWatcher::removePaths: list is empty
This commit is contained in:
parent
1da58b6a4c
commit
9d32807e33
@ -63,10 +63,13 @@ class ExternalEditor(QObject):
|
||||
def _cleanup(self):
|
||||
"""Clean up temporary files after the editor closed."""
|
||||
assert self._remove_file is not None
|
||||
if self._watcher:
|
||||
failed = self._watcher.removePaths(self._watcher.files())
|
||||
|
||||
watched_files = self._watcher.files() if self._watcher else []
|
||||
if watched_files:
|
||||
failed = self._watcher.removePaths(watched_files)
|
||||
if failed:
|
||||
log.procs.error("Failed to unwatch paths: {}".format(failed))
|
||||
|
||||
if self._filename is None or not self._remove_file:
|
||||
# Could not create initial file.
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user