Commit e54dde4b authored by Michael Büsch's avatar Michael Büsch

GUI: Catch and handle fatal exceptions in RUN state

Signed-off-by: Michael Büsch's avatarMichael Buesch <m@bues.ch>
parent 317bec4b
......@@ -19,6 +19,7 @@ if isPyPy:
import os
import time
import getopt
import traceback
try:
from PySide.QtCore import *
......@@ -36,6 +37,15 @@ opt_awlSource = None
opt_extInsns = False
def handleFatalException(parentWidget=None):
QMessageBox.critical(parentWidget,
"A fatal exception occurred",
"A fatal exception occurred:\n\n"
"%s\n\n"
"Awlsim will be terminated." %\
(traceback.format_exc(),))
sys.exit(1)
class StateWindow(QWidget):
closed = Signal()
cpuStateChanged = Signal()
......@@ -654,6 +664,8 @@ class CpuWidget(QWidget):
str(e))
self.stop()
return
except Exception:
handleFatalException(self)
self.runStateChanged.emit(self.state)
while self.state == self.STATE_RUN:
try:
......@@ -663,6 +675,8 @@ class CpuWidget(QWidget):
QMessageBox.critical(self, "Simulator exception",
str(e))
self.stop()
except Exception:
handleFatalException(self)
self.runStateChanged.emit(self.state)
def stop(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment