From 90f12a1d5abb7427a8e35a1ad767e793915640ca Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sat, 4 Mar 2017 11:30:41 +0100 Subject: [PATCH] return fast from DownloadItem.open_file Fixes #2296 By using a singleshot timer, we return fast from DownloadItem.open_file, which in turn closes the prompt fast, which in turn doesn't allow a second Ctrl-x to be registered, which in turn doesn't want to set the filename twice. --- qutebrowser/browser/downloads.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index 8a1a7853a..0e6a7af4f 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -529,7 +529,11 @@ class AbstractDownloadItem(QObject): if filename is None: # pragma: no cover log.downloads.error("No filename to open the download!") return - utils.open_file(filename, cmdline) + # By using a singleshot timer, we ensure that we return fast. This + # is important on systems where process creation takes long, as + # otherwise the prompt might hang around and cause bugs + # (see issue #2296) + QTimer.singleShot(0, lambda: utils.open_file(filename, cmdline)) def _ensure_can_set_filename(self, filename): """Make sure we can still set a filename."""