Add defines to disable setlocale and fork. Disable that code by default for now.
authorMichael Sartain <mikesart@valvesoftware.com>
Tue, 05 Feb 2013 12:10:54 -0800
changeset 6835c259f0817583
parent 6834 dce4e1d1eca3
child 6836 b0ca1571caf3
Add defines to disable setlocale and fork. Disable that code by default for now.
src/video/x11/SDL_x11messagebox.c
     1.1 --- a/src/video/x11/SDL_x11messagebox.c	Tue Feb 05 12:09:59 2013 -0800
     1.2 +++ b/src/video/x11/SDL_x11messagebox.c	Tue Feb 05 12:10:54 2013 -0800
     1.3 @@ -31,7 +31,8 @@
     1.4  #include <locale.h>
     1.5  
     1.6  
     1.7 -#define SDL_FORK_MESSAGEBOX 1
     1.8 +#define SDL_FORK_MESSAGEBOX 0
     1.9 +#define SDL_SET_LOCALE      0
    1.10  
    1.11  #if SDL_FORK_MESSAGEBOX
    1.12  #include <sys/types.h>
    1.13 @@ -645,13 +646,16 @@
    1.14  {
    1.15      int ret;
    1.16      SDL_MessageBoxDataX11 data;
    1.17 +#if SDL_SET_LOCALE
    1.18      char *origlocale;
    1.19 +#endif
    1.20  
    1.21      SDL_zero(data);
    1.22  
    1.23      if ( !SDL_X11_LoadSymbols() )
    1.24          return -1;
    1.25  
    1.26 +#if SDL_SET_LOCALE
    1.27      origlocale = setlocale(LC_ALL, NULL);
    1.28      if (origlocale != NULL) {
    1.29          origlocale = SDL_strdup(origlocale);
    1.30 @@ -661,6 +665,7 @@
    1.31          }
    1.32          setlocale(LC_ALL, "");
    1.33      }
    1.34 +#endif
    1.35  
    1.36      /* This code could get called from multiple threads maybe? */
    1.37      XInitThreads();
    1.38 @@ -682,10 +687,12 @@
    1.39  
    1.40      X11_MessageBoxShutdown( &data );
    1.41  
    1.42 +#if SDL_SET_LOCALE
    1.43      if (origlocale) {
    1.44          setlocale(LC_ALL, origlocale);
    1.45          SDL_free(origlocale);
    1.46      }
    1.47 +#endif
    1.48  
    1.49      return ret;
    1.50  }
    1.51 @@ -700,6 +707,9 @@
    1.52      int fds[2];
    1.53      int status = 0;
    1.54  
    1.55 +	/* Need to flush here in case someone has turned grab off and it hasn't gone through yet, etc. */
    1.56 +	XFlush(data->display);
    1.57 +
    1.58      if (pipe(fds) == -1) {
    1.59          return X11_ShowMessageBoxImpl(messageboxdata, buttonid); /* oh well. */
    1.60      }