[vlc-commits] skins2: fix vlc sometimes crashing with drag'n'drop.

Erwan Tulou git at videolan.org
Sat Apr 21 19:43:54 CEST 2012


vlc/vlc-2.0 | branch: master | Erwan Tulou <erwan10 at videolan.org> | Tue Apr 17 00:52:57 2012 +0200| [a7de3a62be724d04ca0a7c8658fee828bff85361] | committer: Jean-Baptiste Kempf

skins2: fix vlc sometimes crashing with drag'n'drop.

This fixes #6599
(cherry picked from commit 15b1a1b943752e8907dd4116096ff0299a0742fd)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/skins2/controls/ctrl_tree.cpp |    3 ++-
 modules/gui/skins2/vars/playtree.cpp      |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/modules/gui/skins2/controls/ctrl_tree.cpp b/modules/gui/skins2/controls/ctrl_tree.cpp
index 32a90db..533440f 100644
--- a/modules/gui/skins2/controls/ctrl_tree.cpp
+++ b/modules/gui/skins2/controls/ctrl_tree.cpp
@@ -513,7 +513,8 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
     {
         EvtDragDrop& evt = static_cast<EvtDragDrop&>(rEvent);
         Playtree& rPlaytree = static_cast<Playtree&>(m_rTree);
-        rPlaytree.insertItems( *m_itOver, evt.getFiles(), false );
+        VarTree& item = ( m_itOver != m_rTree.end() ) ? *m_itOver : m_rTree;
+        rPlaytree.insertItems( item, evt.getFiles(), false );
         m_itOver = m_rTree.end();
         needRefresh = true;
     }
diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp
index 918d4b1..4f760ef 100644
--- a/modules/gui/skins2/vars/playtree.cpp
+++ b/modules/gui/skins2/vars/playtree.cpp
@@ -280,15 +280,29 @@ void Playtree::insertItems( VarTree& elem, const list<string>& files, bool start
 
     playlist_Lock( m_pPlaylist );
 
+    if( p_elem == this )
+    {
+        for( Iterator it = m_children.begin(); it != m_children.end(); ++it )
+        {
+            if( it->getId() == m_pPlaylist->p_local_category->i_id )
+            {
+                p_elem = &*it;
+                break;
+            }
+        }
+    }
+
     if( p_elem->getId() == m_pPlaylist->p_local_category->i_id )
     {
         p_node = m_pPlaylist->p_local_category;
         i_pos = 0;
+        p_elem->setExpanded( true );
     }
     else if( p_elem->getId() == m_pPlaylist->p_ml_category->i_id )
     {
         p_node = m_pPlaylist->p_ml_category;
         i_pos = 0;
+        p_elem->setExpanded( true );
     }
     else if( p_elem->size() && p_elem->isExpanded() )
     {



More information about the vlc-commits mailing list