Windows: Fixed crash if using current SDL_GetWindowWMInfo() from older programs.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Fri, 18 Nov 2016 00:06:09 +0100
changeset 1063129871de88287
parent 10630 e84b1dbe4113
child 10632 e5f5afc9f3fb
Windows: Fixed crash if using current SDL_GetWindowWMInfo() from older programs.
src/video/windows/SDL_windowswindow.c
     1.1 --- a/src/video/windows/SDL_windowswindow.c	Fri Nov 18 00:05:54 2016 +0100
     1.2 +++ b/src/video/windows/SDL_windowswindow.c	Fri Nov 18 00:06:09 2016 +0100
     1.3 @@ -697,9 +697,15 @@
     1.4  {
     1.5      const SDL_WindowData *data = (const SDL_WindowData *) window->driverdata;
     1.6      if (info->version.major <= SDL_MAJOR_VERSION) {
     1.7 +        int versionnum = SDL_VERSIONNUM(info->version.major, info->version.minor, info->version.patch);
     1.8 +
     1.9          info->subsystem = SDL_SYSWM_WINDOWS;
    1.10          info->info.win.window = data->hwnd;
    1.11 -        info->info.win.hdc = data->hdc;
    1.12 +
    1.13 +        if (versionnum >= SDL_VERSIONNUM(2, 0, 4)) {
    1.14 +            info->info.win.hdc = data->hdc;
    1.15 +        }
    1.16 +
    1.17          return SDL_TRUE;
    1.18      } else {
    1.19          SDL_SetError("Application not compiled with SDL %d.%d\n",