Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed crashes when resizing video modes
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Dec 5, 2008
1 parent df16564 commit bc243d1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/SDL_compat.c
Expand Up @@ -38,7 +38,6 @@ static SDL_Surface *SDL_ShadowSurface = NULL;
static SDL_Surface *SDL_PublicSurface = NULL;
static SDL_GLContext *SDL_VideoContext = NULL;
static Uint32 SDL_VideoFlags = 0;
static int SDL_VideoBPP = 0;
static char *wm_title = NULL;

char *
Expand Down Expand Up @@ -431,15 +430,17 @@ SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags)
SDL_VideoSurface->h * SDL_VideoSurface->pitch);
}
SDL_SetClipRect(SDL_VideoSurface, NULL);
SDL_InvalidateMap(SDL_VideoSurface->map);

if (SDL_ShadowSurface) {
SDL_ShadowSurface->w = width;
SDL_ShadowSurface->h = height;
SDL_CalculatePitch(SDL_ShadowSurface);
SDL_ShadowSurface->pitch = SDL_CalculatePitch(SDL_ShadowSurface);
SDL_ShadowSurface->pixels =
SDL_realloc(SDL_ShadowSurface->pixels,
SDL_ShadowSurface->h * SDL_ShadowSurface->pitch);
SDL_SetClipRect(SDL_ShadowSurface, NULL);
SDL_InvalidateMap(SDL_ShadowSurface->map);
}

ClearVideoSurface();
Expand Down

0 comments on commit bc243d1

Please sign in to comment.