Module: wine Branch: master Commit: 0d3c026bdbac619fb78026a090a3592575df6768 URL: https://source.winehq.org/git/wine.git/?a=commit;h=0d3c026bdbac619fb78026a09...
Author: Rémi Bernon rbernon@codeweavers.com Date: Mon Mar 7 10:40:23 2022 +0100
windows.gaming.input: Make QueryInterface implementations consistent.
When COM aggregation is involved it is important to add a reference to the returned iface and not to the inner object.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/windows.gaming.input/controller.c | 6 ++---- dlls/windows.gaming.input/gamepad.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/dlls/windows.gaming.input/controller.c b/dlls/windows.gaming.input/controller.c index 654d0795eac..75ead342004 100644 --- a/dlls/windows.gaming.input/controller.c +++ b/dlls/windows.gaming.input/controller.c @@ -46,15 +46,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID IsEqualGUID( iid, &IID_IAgileObject ) || IsEqualGUID( iid, &IID_IActivationFactory )) { - IUnknown_AddRef( iface ); - *out = iface; + IInspectable_AddRef( (*out = &impl->IActivationFactory_iface) ); return S_OK; }
if (IsEqualGUID( iid, &IID_IRawGameControllerStatics )) { - IUnknown_AddRef( iface ); - *out = &impl->IRawGameControllerStatics_iface; + IInspectable_AddRef( (*out = &impl->IRawGameControllerStatics_iface) ); return S_OK; }
diff --git a/dlls/windows.gaming.input/gamepad.c b/dlls/windows.gaming.input/gamepad.c index 231e923b5e8..ab95b4c8d89 100644 --- a/dlls/windows.gaming.input/gamepad.c +++ b/dlls/windows.gaming.input/gamepad.c @@ -46,15 +46,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID IsEqualGUID( iid, &IID_IAgileObject ) || IsEqualGUID( iid, &IID_IActivationFactory )) { - IUnknown_AddRef( iface ); - *out = iface; + IInspectable_AddRef( (*out = &impl->IActivationFactory_iface) ); return S_OK; }
if (IsEqualGUID( iid, &IID_IGamepadStatics )) { - IUnknown_AddRef( iface ); - *out = &impl->IGamepadStatics_iface; + IInspectable_AddRef( (*out = &impl->IGamepadStatics_iface) ); return S_OK; }