Skip to content
Permalink
Browse files
Don't crash when python exceptions occur in non-main thread
  • Loading branch information
nyalldawson committed Dec 5, 2016
1 parent 4c0f4ee commit eb34079c01416ebe2a0113e2b2b24efbb9c5cecb
Showing with 7 additions and 1 deletion.
  1. +7 −1 python/utils.py
@@ -193,7 +193,13 @@ def open_stack_dialog(type, value, tb, msg, pop_error=True):


def qgis_excepthook(type, value, tb):
showException(type, value, tb, None, messagebar=True)
# detect if running in the main thread
in_main_thread = True
if QThread.currentThread() != QgsApplication.instance().thread():
in_main_thread = False

# only use messagebar if running in main thread - otherwise it will crash!
showException(type, value, tb, None, messagebar=in_main_thread)


def installErrorHook():

0 comments on commit eb34079

Please sign in to comment.