Skip to content

WinMM: own an output handle only after a successful open - #286

Open
jcelerier wants to merge 2 commits into
masterfrom
fix/windows-handle
Open

jcelerier wants to merge 2 commits into
masterfrom
fix/windows-handle

Conversation

@jcelerier

Copy link
Copy Markdown
Member

Fixes #253.

Initialize the native output handle to null. Give midiOutOpen a local output slot; publish it to the backend only on success.

The hardware-independent regression records native close calls and covers never opened, missing port, native open failure (with the output slot overwritten), and repeated close after a successful open. The probe on d240e3f reported closed 2 unowned handles. On this branch the expanded test passed on MSYS2 CLANG64 / UCRT64 GCC 16, clang-cl, and MSVC; CTest passed on CLANG64. No MIDI hardware or optional SDK required.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WinMM: midi_out_winmm::outHandle is never initialized, so the destructor can call midiOutClose on an indeterminate handle

1 participant