# HG changeset patch # User Ryan C. Gordon # Date 1063633885 0 # Node ID 42ed44b2c8b631eabcdad0e9e35f868869c498ee # Parent f25e3334d5834f938e2d1f43f4b0d4f739f3d921 Date: Sun, 14 Sep 2003 17:04:55 -0400 From: Philip D.S. Thoren Reply-To: "sdl@libsdl.org" To: "sdl@libsdl.org" Subject: [SDL] BUG in src/video/windx5/SDL_dx5events.c I tracked down a bug that crashed my program on Windows *all* the time. FILE: src/video/windx5/SDL_dx5events.c FUNCTION: handle_mouse BUG: SDL_PublicSurface is being dereferenced when it is NULL. I added the following to the very begining of handle_mouse and it solved my crashing problems: if (SDL_PublicSurface == NULL) return; ~ Philip D.S. Thoren diff -r f25e3334d583 -r 42ed44b2c8b6 src/video/windx5/SDL_dx5events.c --- a/src/video/windx5/SDL_dx5events.c Sat Sep 13 02:20:32 2003 +0000 +++ b/src/video/windx5/SDL_dx5events.c Mon Sep 15 13:51:25 2003 +0000 @@ -277,6 +277,11 @@ Uint8 button; DWORD timestamp = 0; + /* Sanity check. Mailing list reports this being NULL unexpectedly. */ + if (SDL_PublicSurface == NULL) { + return; + } + /* If we are in windowed mode, Windows is taking care of the mouse */ if ( (SDL_PublicSurface->flags & SDL_OPENGL) || !(SDL_PublicSurface->flags & SDL_FULLSCREEN) ) {