Date: Sun, 14 Sep 2003 17:04:55 -0400
authorRyan C. Gordon <icculus@icculus.org>
Mon, 15 Sep 2003 13:51:25 +0000
changeset 717 42ed44b2c8b6
parent 716 f25e3334d583
child 718 cbc0f7fabd1c
Date: Sun, 14 Sep 2003 17:04:55 -0400 From: Philip D.S. Thoren <pthoren@cs.uml.edu> Reply-To: "sdl@libsdl.org" <sdl@libsdl.org> To: "sdl@libsdl.org" <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
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) ) {