#1757·JUCE

[Bug]: ump::Endpoints::removeListener() calls addListener()

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

Detailed steps on how to reproduce the bug

modules/juce_audio_devices/midi_io/ump/juce_UMPEndpoints.cpp, lines 186-190:

cpp
void Endpoints::removeListener (EndpointsListener& x)
{
    if (impl != nullptr)
        impl->addListener (x);   // should be impl->removeListener (x)
}

A listener can never be removed. A listener destroyed after calling removeListener() stays registered, and the next device change calls into the destroyed object. Impl::removeListener() already exists (line 108), so the fix is a one-word change. The code has been like this since 9.0.0 and is unchanged on develop.

We work around it by registering a single listener for the life of the process.

What is the expected behaviour?

removeListener() detaches the listener.

Operating systems

All (shared code). We hit it on Windows.

Testing on the develop branch

Present on develop (a6aab3a6bd).