Fixed recursion crash when setting SDL_VIDEO_RENDERER=software
authorSam Lantinga <slouken@libsdl.org>
Thu, 03 Feb 2011 17:42:58 -0800
changeset 5168db487f28419e
parent 5167 88c656ffea44
child 5169 ededa1ccf91c
Fixed recursion crash when setting SDL_VIDEO_RENDERER=software
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Thu Feb 03 16:57:38 2011 -0800
     1.2 +++ b/src/video/SDL_video.c	Thu Feb 03 17:42:58 2011 -0800
     1.3 @@ -126,7 +126,19 @@
     1.4  
     1.5      renderer = data->renderer;
     1.6      if (!renderer) {
     1.7 -        renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
     1.8 +        SDL_RendererInfo info;
     1.9 +        int i;
    1.10 +
    1.11 +        /* We need to make sure we don't get a software renderer */
    1.12 +        for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
    1.13 +            SDL_GetRenderDriverInfo(i, &info);
    1.14 +            if (SDL_strcmp(info.name, "software") != 0) {
    1.15 +                renderer = SDL_CreateRenderer(window, i, 0);
    1.16 +                if (renderer) {
    1.17 +                    break;
    1.18 +                }
    1.19 +            }
    1.20 +        }
    1.21          if (!renderer) {
    1.22              return -1;
    1.23          }