Esme Povirk (@madewokherd) commented about dlls/uiautomationcore/uia_client.c:
}
/* - * AddRef huianode since we're returning a reference to the same node we - * passed in, rather than creating a new one. + * If we're returning a reference to the same node we passed in, make sure + * to AddRef it. */ - IWineUiaNode_AddRef(&node->IWineUiaNode_iface); + if (ret_node == huianode)
I don't like this very much. It's a bit confusing to keep track of the flow of references since it's disconnected from variable assignments. My suggestion would be to addref when assigning to ret_node, and release if the function returns failure. (In fact, I just realized the confusing flow hid a leak where the return statements in between here and the ret_node assignment won't release ret_node.) Maybe some restructuring to avoid an unneeded addref/release of huianode would make it simpler, not sure. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2670#note_30394