Quellcode durchsuchen

wayland+x11: free system cursors when quiting video

Anonymous Maarten vor 1 Jahr
Ursprung
Commit
fbb0914b78
2 geänderte Dateien mit 12 neuen und 0 gelöschten Zeilen
  1. 6 0
      src/video/wayland/SDL_waylandmouse.c
  2. 6 0
      src/video/x11/SDL_x11mouse.c

+ 6 - 0
src/video/wayland/SDL_waylandmouse.c

@@ -831,6 +831,7 @@ void Wayland_InitMouse(void)
 void Wayland_FiniMouse(SDL_VideoData *data)
 {
     struct SDL_WaylandInput *input = data->input;
+    int i;
 
     Wayland_FreeCursorThemes(data);
 
@@ -840,6 +841,11 @@ void Wayland_FiniMouse(SDL_VideoData *data)
 
     SDL_DelHintCallback(SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP,
                         Wayland_EmulateMouseWarpChanged, input);
+
+    for (i = 0; i < SDL_arraysize(sys_cursors); i++) {
+        Wayland_FreeCursor(sys_cursors[i]);
+        sys_cursors[i] = NULL;
+    }
 }
 
 void Wayland_SetHitTestCursor(SDL_HitTestResult rc)

+ 6 - 0
src/video/x11/SDL_x11mouse.c

@@ -511,6 +511,12 @@ void X11_QuitMouse(SDL_VideoDevice *_this)
     SDL_VideoData *data = _this->driverdata;
     SDL_XInput2DeviceInfo *i;
     SDL_XInput2DeviceInfo *next;
+    int j;
+
+    for (j = 0; j < SDL_arraysize(sys_cursors); j++) {
+        X11_FreeCursor(sys_cursors[j]);
+        sys_cursors[j] = NULL;
+    }
 
     for (i = data->mouse_device_info; i; i = next) {
         next = i->next;