v5: Take references on the sync objects in get_sync, tweak creation to initialize sync member to NULL first.
Also I've created https://gitlab.winehq.org/wine/wine/-/merge_requests/7985 to give an overview of where I'd like this to go.
I've dropped the idea of splitting the interface, but I think using actual objects for sync with reference count is a good idea. In that branch it's used for instance to share the same sync primitive between console objects and its children, and avoid having to loop over them all to signal/reset them.