Fixed bug 4013 - Wayland: fix videoquit on multimonitor system
authorSam Lantinga <slouken@libsdl.org>
Wed, 03 Jan 2018 10:49:26 -0800
changeset 118140d9b386fefb7
parent 11813 ea7c4b476853
child 11815 16dbfcc5e455
Fixed bug 4013 - Wayland: fix videoquit on multimonitor system

Vladimir

On multimonitor system Wayland_VideoQuit invalid deiniting.

Tested in Centos7 + Weston
src/video/wayland/SDL_waylandvideo.c
     1.1 --- a/src/video/wayland/SDL_waylandvideo.c	Wed Jan 03 10:43:01 2018 -0800
     1.2 +++ b/src/video/wayland/SDL_waylandvideo.c	Wed Jan 03 10:49:26 2018 -0800
     1.3 @@ -233,6 +233,7 @@
     1.4      mode.w = width;
     1.5      mode.h = height;
     1.6      mode.refresh_rate = refresh / 1000; // mHz to Hz
     1.7 +    mode.driverdata = display->driverdata;
     1.8      SDL_AddDisplayMode(display, &mode);
     1.9  
    1.10      if (flags & WL_OUTPUT_MODE_CURRENT) {
    1.11 @@ -408,7 +409,7 @@
    1.12  Wayland_VideoQuit(_THIS)
    1.13  {
    1.14      SDL_VideoData *data = _this->driverdata;
    1.15 -    int i;
    1.16 +    int i, j;
    1.17  
    1.18      Wayland_FiniMouse ();
    1.19  
    1.20 @@ -416,6 +417,11 @@
    1.21          SDL_VideoDisplay *display = &_this->displays[i];
    1.22          wl_output_destroy(display->driverdata);
    1.23          display->driverdata = NULL;
    1.24 +
    1.25 +        for (j = display->num_display_modes; j--;) {
    1.26 +            display->display_modes[j].driverdata = NULL;
    1.27 +        }
    1.28 +        display->desktop_mode.driverdata = NULL;
    1.29      }
    1.30  
    1.31      Wayland_display_destroy_input(data);