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

Huw Davies (@huw) wine at gitlab.winehq.org
Thu Jun 9 08:52:40 CDT 2022

On Thu Jun  9 13:44:28 2022 +0000, Connor McAdams wrote:
> 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.
It's obviously fine because you've still got a reference on the acc's, but it looks strange.

Avoiding the QI is a pointless optimization and just adds to the code size.


More information about the wine-devel mailing list