diff --git a/src/player/Control.hxx b/src/player/Control.hxx index 0db6698dd..ac0d53800 100644 --- a/src/player/Control.hxx +++ b/src/player/Control.hxx @@ -351,6 +351,17 @@ public: */ void LockSetBorderPause(bool border_pause); + bool ApplyBorderPause() { + if (border_pause) + state = PlayerState::PAUSE; + return border_pause; + } + + bool LockApplyBorderPause() { + const ScopeLock lock(mutex); + return ApplyBorderPause(); + } + void Kill(); gcc_pure diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx index e1144a55c..5448a5408 100644 --- a/src/player/Thread.cxx +++ b/src/player/Thread.cxx @@ -948,18 +948,11 @@ Player::SongBorder() ActivateDecoder(); - pc.Lock(); - - const bool border_pause = pc.border_pause; + const bool border_pause = pc.LockApplyBorderPause(); if (border_pause) { paused = true; - pc.state = PlayerState::PAUSE; - } - - pc.Unlock(); - - if (border_pause) idle_add(IDLE_PLAYER); + } } inline void