From 8fdbd94d71cc69a4236397034a9ba63095b3ad7a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 21 Dec 2015 08:35:09 +0100 Subject: [PATCH] userscripts: Remove on_proc_error. When there was an error, the finished signal will be emitted too anyways, so if we call cleanup here, we'll call it twice which means we'll get an exception. Supersedes #1175. --- CHANGELOG.asciidoc | 1 + qutebrowser/commands/userscripts.py | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 931183a13..a19111792 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -121,6 +121,7 @@ Fixed (U+2028/U+2029/BOM). - Movements in caret mode now should work correctly on OS X and Windows. - Fixed upgrade from earlier config versions. +- Fixed crash when killing a running userscript. v0.4.1 ------ diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py index 315433c0d..59a39b82a 100644 --- a/qutebrowser/commands/userscripts.py +++ b/qutebrowser/commands/userscripts.py @@ -113,7 +113,6 @@ class _BaseUserscriptRunner(QObject): self._proc = guiprocess.GUIProcess(self._win_id, 'userscript', additional_env=self._env, verbose=verbose, parent=self) - self._proc.error.connect(self.on_proc_error) self._proc.finished.connect(self.on_proc_finished) self._proc.start(cmd, args) @@ -158,10 +157,6 @@ class _BaseUserscriptRunner(QObject): """ raise NotImplementedError - def on_proc_error(self, error): - """Called when the process encountered an error.""" - raise NotImplementedError - class _POSIXUserscriptRunner(_BaseUserscriptRunner): @@ -202,10 +197,6 @@ class _POSIXUserscriptRunner(_BaseUserscriptRunner): """Interrupt the reader when the process finished.""" self.finish() - def on_proc_error(self, error): - """Interrupt the reader when the process had an error.""" - self.finish() - def finish(self): """Quit the thread and clean up when the reader finished.""" log.procs.debug("Cleaning up") @@ -256,11 +247,6 @@ class _WindowsUserscriptRunner(_BaseUserscriptRunner): self._cleanup() self.finished.emit() - def on_proc_error(self, error): - """Clean up when the process had an error.""" - self._cleanup() - self.finished.emit() - def run(self, cmd, *args, env=None, verbose=False): try: self._oshandle, self._filepath = tempfile.mkstemp(text=True)