Try a different way of fixing userscript crashes

This commit is contained in:
Florian Bruhin 2017-06-11 14:44:19 +02:00
parent a49adc6298
commit 2e5620cac1
2 changed files with 13 additions and 7 deletions

View File

@ -130,6 +130,7 @@ Fixed
- (QtWebEngine) HTML fullscreen is now tracked for each tab separately, which
means it's not possible anymore to accidentally get stuck in fullscreen state
by closing a tab with a fullscreen video.
- For some people, running some userscripts crashed - this should now be fixed.
- Various other rare crashes should now be fixed.
- The settings documentation was truncated with v0.10.1 which should now be
fixed.

View File

@ -64,14 +64,19 @@ class _QtFIFOReader(QObject):
def read_line(self):
"""(Try to) read a line from the FIFO."""
log.procs.debug("QSocketNotifier triggered!")
self._notifier.setEnabled(False)
try:
for line in self._fifo:
self.got_line.emit(line.rstrip('\r\n'))
self._notifier.setEnabled(True)
except UnicodeDecodeError as e:
log.misc.error("Invalid unicode in userscript output: {}"
.format(e))
self._notifier.setEnabled(False)
try:
for line in self._fifo:
self.got_line.emit(line.rstrip('\r\n'))
self._notifier.setEnabled(True)
except UnicodeDecodeError as e:
log.misc.error("Invalid unicode in userscript output: {}"
.format(e))
except RuntimeError as e:
# For unknown reasons, read_line can still get called after the
# QSocketNotifier was already deleted...
log.procs.debug("While reading userscript output: {}".format(e))
def cleanup(self):
"""Clean up so the FIFO can be closed."""