# HG changeset patch # User Sam Lantinga # Date 1252339484 0 # Node ID 85bf3f297b5c9f471b7269796c04eb04f5401a41 # Parent 22ac66da0765ebf1f8c362747fe0ab130170741c Kenneth Bull to SDL I noticed in trunk/SDL/src/video/win32/SDL_win32events.c, in this code here... ... if the device handle isn't found in mice[], which it won't be if the mouse was plugged in after SDL_Init, then you end up with an uninitialized value in index, which is then passed to various SDL_SendMouse* functions. diff -r 22ac66da0765 -r 85bf3f297b5c src/video/win32/SDL_win32events.c --- a/src/video/win32/SDL_win32events.c Mon Sep 07 05:06:34 2009 +0000 +++ b/src/video/win32/SDL_win32events.c Mon Sep 07 16:04:44 2009 +0000 @@ -236,7 +236,7 @@ { LPBYTE lpb; const RAWINPUTHEADER *header; - int index; + int index = -1; int i; int size = 0; const RAWMOUSE *raw_mouse = NULL; @@ -261,6 +261,10 @@ break; } } + if (index < 0) { + /* New mouse? Should we dynamically update mouse list? */ + return (0); + } GetCursorPos(&point); ScreenToClient(hwnd, &point);