Fixed memory leak and removed debug code from Windows sensor implementation
authorSam Lantinga <slouken@libsdl.org>
Wed, 08 Apr 2020 09:00:10 -0700
changeset 137140d9ea2541827
parent 13713 77f5e012f3e4
child 13715 e8788447f3a6
Fixed memory leak and removed debug code from Windows sensor implementation
src/sensor/windows/SDL_windowssensor.c
test/testgamecontroller.c
     1.1 --- a/src/sensor/windows/SDL_windowssensor.c	Wed Apr 08 08:42:15 2020 -0700
     1.2 +++ b/src/sensor/windows/SDL_windowssensor.c	Wed Apr 08 09:00:10 2020 -0700
     1.3 @@ -281,6 +281,9 @@
     1.4  	} else {
     1.5  		name = SDL_strdup("Unknown Sensor");
     1.6  	}
     1.7 +    if (bstr_name != NULL) {
     1.8 +        SysFreeString(bstr_name);
     1.9 +    }
    1.10  	if (!name) {
    1.11  		return SDL_OutOfMemory();
    1.12  	}
    1.13 @@ -339,8 +342,6 @@
    1.14  	HRESULT hr;
    1.15  	ISensorCollection *sensor_collection = NULL;
    1.16  
    1.17 -	while (!IsDebuggerPresent()) Sleep(100);
    1.18 -
    1.19  	if (WIN_CoInitialize() == S_OK) {
    1.20  		SDL_windowscoinit = SDL_TRUE;
    1.21  	}
     2.1 --- a/test/testgamecontroller.c	Wed Apr 08 08:42:15 2020 -0700
     2.2 +++ b/test/testgamecontroller.c	Wed Apr 08 09:00:10 2020 -0700
     2.3 @@ -261,6 +261,8 @@
     2.4      /* Enable standard application logging */
     2.5      SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
     2.6  
     2.7 +	SDL_SetHint( SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1" );
     2.8 +
     2.9      /* Initialize SDL (Note: video is required to start event loop) */
    2.10      if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER ) < 0) {
    2.11          SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());