Fix 52317bb7: [SDL2] ensure we don't try to blit out of bounds (#8684)

During resizing, there can still be dirty-rects ready to blit based
on the old dimensions. X11 with shared memory enabled crashes if
you try to do this. So, instead, if we resize, reset the dirty-rects.

This is fine, as moments later we mark the whole (new) screen as
dirty anyway.
pull/221/head
Patric Stout 3 years ago committed by GitHub
parent 7bdb2e79ed
commit 6de188d025
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -351,6 +351,13 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h, bool resize)
_sdl_surface = _sdl_real_surface;
}
/* X11 doesn't appreciate it if we invalidate areas outside the window
* if shared memory is enabled (read: it crashes). So, as we might have
* gotten smaller, reset our dirty rects. GameSizeChanged() a bit lower
* will mark the whole screen dirty again anyway, but this time with the
* new dimensions. */
_num_dirty_rects = 0;
_screen.width = _sdl_surface->w;
_screen.height = _sdl_surface->h;
_screen.pitch = _sdl_surface->pitch / (bpp / 8);

Loading…
Cancel
Save