[vlc-commits] qt: playlist: Fix deadlock when reordering playlist
Hugo Beauzée-Luyssen
git at videolan.org
Mon Jan 23 18:08:05 CET 2017
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Jan 23 17:28:38 2017 +0100| [928b4fe4aa2327230020c4de03795be08cb9c870] | committer: Hugo Beauzée-Luyssen
qt: playlist: Fix deadlock when reordering playlist
dragMove already has the playlist lock held, so calling findByInput
would always cause a deadlock
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=928b4fe4aa2327230020c4de03795be08cb9c870
---
modules/gui/qt/components/playlist/playlist_model.cpp | 12 +++++++++++-
modules/gui/qt/components/playlist/playlist_model.hpp | 1 +
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt/components/playlist/playlist_model.cpp b/modules/gui/qt/components/playlist/playlist_model.cpp
index d4b5df7..d8bf081 100644
--- a/modules/gui/qt/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt/components/playlist/playlist_model.cpp
@@ -220,7 +220,7 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row )
playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
if( !p_item ) continue;
- PLItem *item = findByInput( rootItem, p_input );
+ PLItem *item = findByInputLocked( rootItem, p_input );
if( !item ) continue;
/* Better not try to move a node into itself.
@@ -549,6 +549,16 @@ PLItem *PLModel::findByInput( PLItem *root, const input_item_t *input ) const
return findByPLId( root, i_id );
}
+PLItem *PLModel::findByInputLocked( PLItem *root, const input_item_t *input ) const
+{
+ PL_ASSERT_LOCKED;
+
+ playlist_item_t* item = playlist_ItemGetByInput( THEPL, input );
+ if( item == NULL )
+ return NULL;
+ return findByPLId( root, item->i_id );
+}
+
PLModel::pl_nodetype PLModel::getPLRootType() const
{
vlc_playlist_locker pl_lock ( THEPL );
diff --git a/modules/gui/qt/components/playlist/playlist_model.hpp b/modules/gui/qt/components/playlist/playlist_model.hpp
index 57441ff..a82ec5c 100644
--- a/modules/gui/qt/components/playlist/playlist_model.hpp
+++ b/modules/gui/qt/components/playlist/playlist_model.hpp
@@ -143,6 +143,7 @@ private:
/* Lookups */
PLItem *findByPLId( PLItem *, int i_plitemid ) const;
PLItem *findByInput( PLItem *, const input_item_t * ) const;
+ PLItem *findByInputLocked( PLItem *, const input_item_t * ) const;
enum pl_nodetype
{
ROOTTYPE_CURRENT_PLAYING,
More information about the vlc-commits
mailing list