소스 검색

Fix Wayland_DestroyWindow SEGFAULT

Check if the wind pointer is NULL, to avoid SEGFAULT.
Already implemented in SDL3, but not yet backported.
hexnet1234 7 달 전
부모
커밋
99ecc409cf
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/video/wayland/SDL_waylandwindow.c

+ 1 - 1
src/video/wayland/SDL_waylandwindow.c

@@ -2292,7 +2292,7 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window)
     SDL_VideoData *data = _this->driverdata;
     SDL_VideoData *data = _this->driverdata;
     SDL_WindowData *wind = window->driverdata;
     SDL_WindowData *wind = window->driverdata;
 
 
-    if (data) {
+    if (data && wind) {
 #ifdef SDL_VIDEO_OPENGL_EGL
 #ifdef SDL_VIDEO_OPENGL_EGL
         if (wind->egl_surface) {
         if (wind->egl_surface) {
             SDL_EGL_DestroySurface(_this, wind->egl_surface);
             SDL_EGL_DestroySurface(_this, wind->egl_surface);