Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't crash when python exceptions occur in non-main thread
  • Loading branch information
nyalldawson committed Dec 5, 2016
1 parent 4c0f4ee commit eb34079
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/utils.py
Expand Up @@ -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():
Expand Down

0 comments on commit eb34079

Please sign in to comment.