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
This commit is contained in:
Harley Acheson 2019-09-29 11:42:02 -07:00
parent 98c0d16da5
commit 3a3e5fb365
Notes: blender-bot 2023-06-07 10:31:13 +02:00
Referenced by issue #69935, File Manager always pops up "no disk drives error" and closes itself upon first run on WIndows 10.
2 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -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);
}