#1758·JUCE

[Bug]: Windows: no notification when a MIDI device is removed and quickly re-added, and the open MidiInput stays silent (9.0.3)

Author: pob31Created Sep 28, 2026Updated Sep 28, 2026

Detailed steps on how to reproduce the bug

Since 7397b2f432 ("MIDI (Windows): Update legacy MIDI device listener to listen specifically for MIDI device interfaces"), the Win32 backend calls endpointsChanged() only when the cached endpoint list differs (if (old != cachedEndpoints), juce_Midi_windows.cpp line 3518 at 9.0.3).

When a device is removed and comes back within the detection delay (about 0.5 s), the list reads the same, so neither EndpointsListener::endpointsChanged() nor MidiDeviceListConnection fires. A MidiInput that was open on the device stays bound to the old handle and never receives anything again, and the app has no way of finding out. In 9.0.2 the old detector called endpointsChanged() after every device change, even with an identical list, so an app could reopen its inputs.

What we observed (a virtual "Probe port" held open by MidiInput, removed and re-created 50 ms later with the teVirtualMIDI API, then a note sent 3.5 s later):

JUCE endpointsChanged() MidiDeviceListConnection Note received by the open MidiInput
9.0.2 yes no no
9.0.3 no no no

We tested with virtual ports only. A brief USB disconnect would presumably look the same.

What is the expected behaviour?

Some notification an app can act on. For example, call endpointsChanged() whenever the detector sees a MIDI device interface arrive or leave, or give MidiInput a disconnection callback.

We've worked around it by registering our own CM_Register_Notification for the MIDI input/output device interface classes (the GUIDs the new detector uses).

Operating systems

Windows

What versions of the operating systems?

Windows 11 Pro 25H2 (build 26200), default JUCE MIDI flags (Win32 backend).

Testing on the develop branch

The relevant code is unchanged on develop (a6aab3a6bd).