[vlc-commits] gui/qt: clean PLModel::isSupportedAction( ACTION_PAUSE, ... )

Filip Roséen git at videolan.org
Sun Jul 24 20:39:15 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Sun Jul 24 15:27:56 2016 +0200| [641a15209c21aee25e970ef70edb45c69b591ec8] | committer: Francois Cartegnie

gui/qt: clean PLModel::isSupportedAction( ACTION_PAUSE, ... )

There is no need to lock the playlist if the index is not associated
with the current item, as such this commits first checks whether this
condition holds or not, only to then lock the playlist (when it is
actually necessary.

PL_LOCK / PL_UNLOCK has also been replaced by usage of
vlc_playlist_locker.

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=641a15209c21aee25e970ef70edb45c69b591ec8
---

 modules/gui/qt/components/playlist/playlist_model.cpp |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt/components/playlist/playlist_model.cpp b/modules/gui/qt/components/playlist/playlist_model.cpp
index b9cd87f..a478754 100644
--- a/modules/gui/qt/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt/components/playlist/playlist_model.cpp
@@ -1027,10 +1027,12 @@ bool PLModel::isSupportedAction( actions action, const QModelIndex &index ) cons
     }
     case ACTION_PAUSE:
     {
-        PL_LOCK;
-        bool b_ret = isCurrent( index ) && playlist_Status(THEPL) == PLAYLIST_RUNNING;
-        PL_UNLOCK;
-        return b_ret;
+		if( !isCurrent( index ) )
+            return false;
+
+        vlc_playlist_locker pl_lock ( THEPL );
+
+        return playlist_Status( THEPL ) == PLAYLIST_RUNNING;
     }
     case ACTION_STREAM:
     case ACTION_SAVE:



More information about the vlc-commits mailing list