Commit: 3a3e5fb365bac2f3ee653c446215727d9e339648
Author: Harley Acheson
Date:   Sun Sep 29 11:42:02 2019 -0700
Branches: master
https://developer.blender.org/rB3a3e5fb365bac2f3ee653c446215727d9e339648

Fix T69935: Silence Win32 OS Error Dialogs

Call SetErrorMode() at startup to prevent error mode dialogs.

Differential Revision: https://developer.blender.org/D5941

Reviewed by Brecht Van Lommel

===================================================================

M       source/blender/blenlib/intern/storage.c
M       source/creator/creator_signals.c

===================================================================

diff --git a/source/blender/blenlib/intern/storage.c 
b/source/blender/blenlib/intern/storage.c
index 8d921b062dc..05a2d766fe0 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -230,14 +230,8 @@ int BLI_exists(const char *name)
     tmp_16[3] = L'\0';
   }
 
-  /* change error mode so user does not get a "no disk in drive" popup
-   * when looking for a file on an empty CD/DVD drive */
-  old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS | 
SEM_NOOPENFILEERRORBOX);
-
   res = BLI_wstat(tmp_16, &st);
 
-  SetErrorMode(old_error_mode);
-
   free(tmp_16);
   if (res == -1) {
     return (0);
diff --git a/source/creator/creator_signals.c b/source/creator/creator_signals.c
index 5a5bc74d2d3..e8c6e9251bc 100644
--- a/source/creator/creator_signals.c
+++ b/source/creator/creator_signals.c
@@ -301,6 +301,12 @@ void main_signal_setup(void)
 #  endif
   }
 
+#  ifdef WIN32
+  /* Prevent any error mode dialogs from hanging the application. */
+  SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT | 
SEM_NOGPFAULTERRORBOX |
+               SEM_NOOPENFILEERRORBOX);
+#  endif
+
   if (app_state.signal.use_abort_handler) {
     signal(SIGABRT, sig_handle_abort);
   }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to