On Mon May 11 11:11:39 2026 +0000, Giovanni Mascellani wrote:
It doesn't look like the code is correct now, though: in test "SignalEventOnFinalResourceRelease with duplicated event" event `event3` is passed to `SignalEventOnFinalResourceRelease()`, the duplicated and closed. Later the same event that has been closed is set in `d3d12_sync_object_async_release_Invoke()`, which is illegal I suppose. I can only imagine it works by chance because whatever was in the handle table corresponding to `event3` hasn't been overwritten yet. The robust implementation should instead store a duplicate of the handle in `final_release_event` and use that to signal in `d3d12_sync_object_async_release_Invoke()`. Or am I missing something? What I was saying is that the current code was already correct (matching windows) and does not need to be modified.
Indeed, the test is not robust and works by chance (but it works almost always - I have not observed it failing). We are testing for WAIT_TIMEOUT - indicating that something has failed and the event was not set (because the handle was closed). This matches windows behavior. If I modify the code as you describe (I've tried this), we get WAIT_OBJECT_0 instead - which would be divergent from windows. Perhaps the test could be removed tho since it is theoretically unreliable, but it still serves to demonstrate this point. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9777#note_139421