From: James Teh Date: Tue, 9 Nov 2010 22:53:24 +0000 (+1000) Subject: LiveText monitor thread: Add some exception handling. X-Git-Tag: jpdev130418~2112^2~10 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=78c424ae52a9c6067b1c1862f3a59b1383f8c6a8;p=nvdajp%2Fnvdajp.git LiveText monitor thread: Add some exception handling. --- diff --git a/source/NVDAObjects/behaviors.py b/source/NVDAObjects/behaviors.py index 8233db76e..6ea2a3fc7 100755 --- a/source/NVDAObjects/behaviors.py +++ b/source/NVDAObjects/behaviors.py @@ -200,17 +200,24 @@ class LiveText(NVDAObject): speech.speakText(line) def _monitor(self): - oldLines = self._getTextLines() + try: + oldLines = self._getTextLines() + except: + log.exception("Error getting initial lines") + oldLines = [] while self._keepMonitoring: self._event.wait() if not self._keepMonitoring: break self._event.clear() - newLines = self._getTextLines() - if globalVars.reportDynamicContentChanges: - for line in self._calculateNewText(newLines, oldLines): - queueHandler.queueFunction(queueHandler.eventQueue, self._reportNewText, line) - oldLines = newLines + try: + newLines = self._getTextLines() + if globalVars.reportDynamicContentChanges: + for line in self._calculateNewText(newLines, oldLines): + queueHandler.queueFunction(queueHandler.eventQueue, self._reportNewText, line) + oldLines = newLines + except: + log.exception("Error getting lines or calculating new text") time.sleep(self.MIN_CHECK_NEW_INTERVAL) def _calculateNewText(self, newLines, oldLines):