Commit 5ca4f681 authored by Sam Lantinga's avatar Sam Lantinga

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.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403790
parent 0b31b507
...@@ -236,7 +236,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -236,7 +236,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
LPBYTE lpb; LPBYTE lpb;
const RAWINPUTHEADER *header; const RAWINPUTHEADER *header;
int index; int index = -1;
int i; int i;
int size = 0; int size = 0;
const RAWMOUSE *raw_mouse = NULL; const RAWMOUSE *raw_mouse = NULL;
...@@ -261,6 +261,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -261,6 +261,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break; break;
} }
} }
if (index < 0) {
/* New mouse? Should we dynamically update mouse list? */
return (0);
}
GetCursorPos(&point); GetCursorPos(&point);
ScreenToClient(hwnd, &point); ScreenToClient(hwnd, &point);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment