diff options
-rw-r--r-- | alc/backends/pipewire.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp index 120e3af6..41949a9b 100644 --- a/alc/backends/pipewire.cpp +++ b/alc/backends/pipewire.cpp @@ -1104,18 +1104,15 @@ void EventManager::removeCallback(uint32_t id) { DeviceNode::Remove(id); - auto elem = mNodeList.begin(); - while(elem != mNodeList.end()) + auto clear_node = [id](NodeProxy *node) noexcept { - NodeProxy *node{*elem}; - if(node->mId == id) - { - al::destroy_at(node); - elem = mNodeList.erase(elem); - continue; - } - ++elem; - } + if(node->mId != id) + return false; + al::destroy_at(node); + return true; + }; + auto node_end = std::remove_if(mNodeList.begin(), mNodeList.end(), clear_node); + mNodeList.erase(node_end, mNodeList.end()); if(mDefaultMetadata && mDefaultMetadata->mId == id) { |