Skip to content

Commit

Permalink
Fixed memory leak and removed debug code from Windows sensor implemen…
Browse files Browse the repository at this point in the history
…tation
  • Loading branch information
slouken committed Apr 8, 2020
1 parent 55515a8 commit 09f5526
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/sensor/windows/SDL_windowssensor.c
Expand Up @@ -281,6 +281,9 @@ static int ConnectSensor(ISensor *sensor)
} else {
name = SDL_strdup("Unknown Sensor");
}
if (bstr_name != NULL) {
SysFreeString(bstr_name);
}
if (!name) {
return SDL_OutOfMemory();
}
Expand Down Expand Up @@ -339,8 +342,6 @@ SDL_WINDOWS_SensorInit(void)
HRESULT hr;
ISensorCollection *sensor_collection = NULL;

while (!IsDebuggerPresent()) Sleep(100);

if (WIN_CoInitialize() == S_OK) {
SDL_windowscoinit = SDL_TRUE;
}
Expand Down
2 changes: 2 additions & 0 deletions test/testgamecontroller.c
Expand Up @@ -261,6 +261,8 @@ main(int argc, char *argv[])
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

SDL_SetHint( SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1" );

/* Initialize SDL (Note: video is required to start event loop) */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER ) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
Expand Down

0 comments on commit 09f5526

Please sign in to comment.