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 - (QtWebEngine) HTML fullscreen is now tracked for each tab separately, which
means it's not possible anymore to accidentally get stuck in fullscreen state means it's not possible anymore to accidentally get stuck in fullscreen state
by closing a tab with a fullscreen video. 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. - Various other rare crashes should now be fixed.
- The settings documentation was truncated with v0.10.1 which should now be - The settings documentation was truncated with v0.10.1 which should now be
fixed. fixed.

View File

@ -64,14 +64,19 @@ class _QtFIFOReader(QObject):
def read_line(self): def read_line(self):
"""(Try to) read a line from the FIFO.""" """(Try to) read a line from the FIFO."""
log.procs.debug("QSocketNotifier triggered!") log.procs.debug("QSocketNotifier triggered!")
self._notifier.setEnabled(False)
try: try:
for line in self._fifo: self._notifier.setEnabled(False)
self.got_line.emit(line.rstrip('\r\n')) try:
self._notifier.setEnabled(True) for line in self._fifo:
except UnicodeDecodeError as e: self.got_line.emit(line.rstrip('\r\n'))
log.misc.error("Invalid unicode in userscript output: {}" self._notifier.setEnabled(True)
.format(e)) 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): def cleanup(self):
"""Clean up so the FIFO can be closed.""" """Clean up so the FIFO can be closed."""