Mercurial > sdl-ios-xcode
comparison src/video/windx5/SDL_dx5events.c @ 4383:daf9e6037596 SDL-1.2
Gregory Smith
Another one for the "How did this ever work?" file: when
DX5_HandleMessage is called with WM_ACTIVATEAPP, it goes past the end
of the 2-element SDL_DIdev array and if there doesn't happen to be a 0
in the memory next to it, crashes. Patch against SVN attached.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 15 Nov 2009 17:21:24 +0000 |
parents | 6cc2b35ac610 |
children | 6800e2560310 |
comparison
equal
deleted
inserted
replaced
4382:6599c89de50c | 4383:daf9e6037596 |
---|---|
557 case WM_ACTIVATEAPP: { | 557 case WM_ACTIVATEAPP: { |
558 int i, active; | 558 int i, active; |
559 | 559 |
560 active = (wParam && (GetForegroundWindow() == hwnd)); | 560 active = (wParam && (GetForegroundWindow() == hwnd)); |
561 if ( active ) { | 561 if ( active ) { |
562 for ( i=0; SDL_DIdev[i]; ++i ) { | 562 for ( i=0; i<MAX_INPUTS; ++i ) { |
563 IDirectInputDevice2_Acquire( | 563 if (SDL_DIdev[i] != NULL) |
564 IDirectInputDevice2_Acquire( | |
564 SDL_DIdev[i]); | 565 SDL_DIdev[i]); |
565 } | 566 } |
566 } else { | 567 } else { |
567 for ( i=0; SDL_DIdev[i]; ++i ) { | 568 for ( i=0; i<MAX_INPUTS; ++i ) { |
568 IDirectInputDevice2_Unacquire( | 569 if (SDL_DIdev[i] != NULL) |
570 IDirectInputDevice2_Unacquire( | |
569 SDL_DIdev[i]); | 571 SDL_DIdev[i]); |
570 } | 572 } |
571 mouse_lost = 1; | 573 mouse_lost = 1; |
572 } | 574 } |
573 } | 575 } |