]> git.sesse.net Git - vlc/commitdiff
win32: call SetErrorMode() while still single-threaded
authorRémi Denis-Courmont <remi@remlab.net>
Fri, 7 Feb 2014 21:05:36 +0000 (23:05 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Fri, 7 Feb 2014 21:06:50 +0000 (23:06 +0200)
(This is required by MSDN.)

bin/cachegen.c
bin/winvlc.c
src/win32/plugin.c

index 383b05e878e1295cf4de7090601add43033da47b..8e72bf40b27d9638ee9284b49506e2e81788ce21 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdbool.h>
-
 #ifdef HAVE_GETOPT_H
 # include <getopt.h>
 #endif
+#ifdef WIN32
+# include <windows.h>
+#endif
 
 static void version (void)
 {
@@ -47,6 +49,9 @@ static void usage (const char *path)
 
 int main (int argc, char *argv[])
 {
+#ifdef WIN32
+    SetErrorMode(SEM_FAILCRITICALERRORS);
+#endif
     static const struct option opts[] =
     {
         { "force",      no_argument,       NULL, 'f' },
index 3b43d1ffbec6bf27d036d26ecbc8d63abfc95751..d44773da2542dcf0a752eca00266b2c05c475873 100644 (file)
@@ -79,6 +79,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
     putenv("VLC_DATA_PATH=Z:"TOP_SRCDIR"/share");
 #endif
 
+    SetErrorMode(SEM_FAILCRITICALERRORS);
     HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
 
     /* SetProcessDEPPolicy */
index a21d5ec5229359b72bcd6ca17c323463fdfe2d23..31c06d6862f53d9a41d91d1f711d3f5de0df72dd 100644 (file)
@@ -58,13 +58,9 @@ int module_Load( vlc_object_t *p_this, const char *psz_file,
         return -1;
 
     module_handle_t handle;
-    /* FIXME: this is not thread-safe -- Courmisch */
-    UINT mode = SetErrorMode (SEM_FAILCRITICALERRORS);
-    SetErrorMode (mode|SEM_FAILCRITICALERRORS);
 
     handle = LoadLibraryW (wfile);
 
-    SetErrorMode (mode);
     free (wfile);
 
     if( handle == NULL )