[vlc-commits] win32: call SetErrorMode() while still single-threaded

Rémi Denis-Courmont git at videolan.org
Fri Feb 7 22:10:58 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Feb  7 23:05:36 2014 +0200| [170e5561c1efcd563f5cdae7291bef32fad12a45] | committer: Rémi Denis-Courmont

win32: call SetErrorMode() while still single-threaded

(This is required by MSDN.)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=170e5561c1efcd563f5cdae7291bef32fad12a45
---

 bin/cachegen.c     |    7 ++++++-
 bin/winvlc.c       |    1 +
 src/win32/plugin.c |    4 ----
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/bin/cachegen.c b/bin/cachegen.c
index 383b05e..8e72bf4 100644
--- a/bin/cachegen.c
+++ b/bin/cachegen.c
@@ -26,10 +26,12 @@
 #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' },
diff --git a/bin/winvlc.c b/bin/winvlc.c
index 3b43d1f..d44773d 100644
--- a/bin/winvlc.c
+++ b/bin/winvlc.c
@@ -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 */
diff --git a/src/win32/plugin.c b/src/win32/plugin.c
index a21d5ec..31c06d6 100644
--- a/src/win32/plugin.c
+++ b/src/win32/plugin.c
@@ -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 )



More information about the vlc-commits mailing list