From 87123af4b44cb31836aabfbd8ba226868f9de2e9 Mon Sep 17 00:00:00 2001 From: cztomczak Date: Fri, 16 Jun 2017 11:52:17 +0200 Subject: [PATCH] Fix ExceptHook bug on Mac - except msg sometimes not printed --- src/helpers.pyx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/helpers.pyx b/src/helpers.pyx index ea8d5e8b..6d7f9c27 100644 --- a/src/helpers.pyx +++ b/src/helpers.pyx @@ -19,8 +19,6 @@ def ExceptHook(exc_type, exc_value, exc_trace): and exit application immediately by ignoring "finally" (_exit()). """ print("[CEF Python] ExceptHook: catched exception, will shutdown CEF") - QuitMessageLoop() - Shutdown() msg = "".join(traceback.format_exception(exc_type, exc_value, exc_trace)) error_file = GetAppPath("error.log") @@ -40,6 +38,11 @@ def ExceptHook(exc_type, exc_value, exc_trace): msg = msg.encode("ascii", errors="replace") msg = msg.decode("ascii", errors="replace") print("\n"+msg) + # There is a strange bug on Mac. Sometimes except message is not + # printed if QuitMessageLoop and Shutdown were called before the print + # message above. + QuitMessageLoop() + Shutdown() # noinspection PyProtectedMember os._exit(1)