client/Idle: consume only idle flags that were subscribed to

Since the very beginning when idle subscriptions where introduced
(commit 0bad84066b), waiting for a certain idle mask would clear
all other idle flags as well.  This would cause idle events to get
lost.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1998
This commit is contained in:
Max Kellermann 2024-03-11 14:59:45 +01:00
parent 7b6909f2c0
commit b0cfdfa257
2 changed files with 5 additions and 2 deletions

1
NEWS
View File

@ -14,6 +14,7 @@ ver 0.24 (not yet released)
- new "search"/"find" filter "added-since" - new "search"/"find" filter "added-since"
- allow range in listplaylist and listplaylistinfo - allow range in listplaylist and listplaylistinfo
- "sticker find" supports sort and window parameter and new sticker compare operators "eq", "lt" and "gt" - "sticker find" supports sort and window parameter and new sticker compare operators "eq", "lt" and "gt"
- consume only idle flags that were subscribed to
* database * database
- attribute "added" shows when each song was added to the database - attribute "added" shows when each song was added to the database
- fix integer overflows with 64-bit inode numbers - fix integer overflows with 64-bit inode numbers

View File

@ -26,9 +26,11 @@ void
Client::IdleNotify() noexcept Client::IdleNotify() noexcept
{ {
assert(idle_waiting); assert(idle_waiting);
assert(idle_flags != 0);
unsigned flags = std::exchange(idle_flags, 0) & idle_subscriptions; const unsigned flags = idle_flags & idle_subscriptions;
idle_flags &= ~idle_subscriptions;
assert(flags != 0);
idle_waiting = false; idle_waiting = false;
Response r(*this, 0); Response r(*this, 0);