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

Erwan Tulou git at videolan.org
Tue Apr 17 03:14:38 CEST 2012


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Tue Apr 17 00:52:57 2012 +0200| [15b1a1b943752e8907dd4116096ff0299a0742fd] | committer: Erwan Tulou

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

This fixes #6599

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

 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 d395626..eed6ea9 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 6ce1b86..9b3c4db 100644
--- a/modules/gui/skins2/vars/playtree.cpp
+++ b/modules/gui/skins2/vars/playtree.cpp
@@ -283,15 +283,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