mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 10:06:07 +08:00
Merge pull request #3005 from fieldOfView/fix_early_crash
Prevent CrashHandler creating a QWidget before QApplication is created
This commit is contained in:
commit
48cf6ad1c9
@ -37,7 +37,7 @@ else:
|
|||||||
# List of exceptions that should be considered "fatal" and abort the program.
|
# List of exceptions that should be considered "fatal" and abort the program.
|
||||||
# These are primarily some exception types that we simply cannot really recover from
|
# These are primarily some exception types that we simply cannot really recover from
|
||||||
# (MemoryError and SystemError) and exceptions that indicate grave errors in the
|
# (MemoryError and SystemError) and exceptions that indicate grave errors in the
|
||||||
# code that cause the Python interpreter to fail (SyntaxError, ImportError).
|
# code that cause the Python interpreter to fail (SyntaxError, ImportError).
|
||||||
fatal_exception_types = [
|
fatal_exception_types = [
|
||||||
MemoryError,
|
MemoryError,
|
||||||
SyntaxError,
|
SyntaxError,
|
||||||
@ -53,7 +53,7 @@ class CrashHandler:
|
|||||||
self.exception_type = exception_type
|
self.exception_type = exception_type
|
||||||
self.value = value
|
self.value = value
|
||||||
self.traceback = tb
|
self.traceback = tb
|
||||||
self.dialog = QDialog()
|
self.dialog = None # Don't create a QDialog before there is a QApplication
|
||||||
|
|
||||||
# While we create the GUI, the information will be stored for sending afterwards
|
# While we create the GUI, the information will be stored for sending afterwards
|
||||||
self.data = dict()
|
self.data = dict()
|
||||||
@ -71,6 +71,7 @@ class CrashHandler:
|
|||||||
if not application:
|
if not application:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
self.dialog = QDialog()
|
||||||
self._createDialog()
|
self._createDialog()
|
||||||
|
|
||||||
## Creates a modal dialog.
|
## Creates a modal dialog.
|
||||||
@ -288,4 +289,4 @@ class CrashHandler:
|
|||||||
# When the exception is not in the fatal_exception_types list, the dialog is not created, so we don't need to show it
|
# When the exception is not in the fatal_exception_types list, the dialog is not created, so we don't need to show it
|
||||||
if self.dialog:
|
if self.dialog:
|
||||||
self.dialog.exec_()
|
self.dialog.exec_()
|
||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user