[PATCH 0/3] MR216: uiautomationcore: More UiaProviderFromIAccessible work.

Connor McAdams (@cmcadams) wine at gitlab.winehq.org
Thu Jun 9 08:44:29 CDT 2022


On Thu Jun  9 13:37:43 2022 +0000, Huw Davies wrote:
> Releasing the ifaces before comparing them looks odd.  This is also done
> in the tests of the third patch.
Yeah, this is something I've borrowed from the oleacc tests, particularly the iface_cmp() function:

```
static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2)
{
    IUnknown *unk1, *unk2;

    if(iface1 == iface2)
        return TRUE;

    IUnknown_QueryInterface(iface1, &IID_IUnknown, (void**)&unk1);
    IUnknown_Release(unk1);
    IUnknown_QueryInterface(iface2, &IID_IUnknown, (void**)&unk2);
    IUnknown_Release(unk2);
    return unk1 == unk2;
}
```

Does it make a difference for comparing the IUnknown pointers if the interface is released? I think in this way, it's just easier than checking, saving the check, then releasing.

This also applies to the prior `if (acc == acc2)` check you commented on, with the idea being that you can early out if the interface pointers match, and avoid a QI to try and match the IUnknown's.

-- 
https://gitlab.winehq.org/wine/wine/-/merge_requests/216#note_1756



More information about the wine-devel mailing list