[Commits] SDL: Added missing call to WindowsDeleteString()

libsdl.org revision control commits-owner at libsdl.org
Thu Sep 20 15:55:54 PDT 2018


details:   https://hg.libsdl.org/SDL/rev/a72347375b36
changeset: 12197:a72347375b36
user:      Sam Lantinga <slouken at libsdl.org>
date:      Thu Sep 20 15:55:52 2018 -0700
description:
Added missing call to WindowsDeleteString()

diffstat:

 src/joystick/hidapi/SDL_hidapi_xbox360.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (31 lines):

diff -r b504b29c3831 -r a72347375b36 src/joystick/hidapi/SDL_hidapi_xbox360.c
--- a/src/joystick/hidapi/SDL_hidapi_xbox360.c	Wed Sep 19 10:03:40 2018 -0700
+++ b/src/joystick/hidapi/SDL_hidapi_xbox360.c	Thu Sep 20 15:55:52 2018 -0700
@@ -140,20 +140,21 @@
         HRESULT hr;
         HMODULE hModule = LoadLibraryA("combase.dll");
         if (hModule != NULL) {
-            typedef HRESULT(WINAPI *WindowsCreateString_t)(PCNZWCH sourceString, UINT32 length, HSTRING* string);
-            typedef HRESULT(WINAPI *RoGetActivationFactory_t)(HSTRING activatableClassId, REFIID iid, void** factory);
+            typedef HRESULT (WINAPI *WindowsCreateString_t)(PCNZWCH sourceString, UINT32 length, HSTRING* string);
+            typedef HRESULT (WINAPI *WindowsDeleteString_t)(HSTRING string);
+            typedef HRESULT (WINAPI *RoGetActivationFactory_t)(HSTRING activatableClassId, REFIID iid, void** factory);
 
             WindowsCreateString_t WindowsCreateStringFunc = (WindowsCreateString_t)GetProcAddress(hModule, "WindowsCreateString");
+            WindowsDeleteString_t WindowsDeleteStringFunc = (WindowsDeleteString_t)GetProcAddress(hModule, "WindowsDeleteString");
             RoGetActivationFactory_t RoGetActivationFactoryFunc = (RoGetActivationFactory_t)GetProcAddress(hModule, "RoGetActivationFactory");
-            if (WindowsCreateStringFunc && RoGetActivationFactoryFunc) {
+            if (WindowsCreateStringFunc && WindowsDeleteStringFunc && RoGetActivationFactoryFunc) {
                 LPTSTR pNamespace = L"Windows.Gaming.Input.Gamepad";
                 HSTRING hNamespaceString;
 
                 hr = WindowsCreateStringFunc(pNamespace, SDL_wcslen(pNamespace), &hNamespaceString);
                 if (SUCCEEDED(hr)) {
-                    hr = RoGetActivationFactoryFunc(hNamespaceString, &SDL_IID_IGamepadStatics, &ctx->gamepad_statics);
-                    if (SUCCEEDED(hr)) {
-                    }
+                    RoGetActivationFactoryFunc(hNamespaceString, &SDL_IID_IGamepadStatics, &ctx->gamepad_statics);
+                    WindowsDeleteStringFunc(hNamespaceString);
                 }
             }
             FreeLibrary(hModule);


More information about the commits mailing list