Commit 15b1a1b9 authored by Erwan Tulou's avatar Erwan Tulou

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

This fixes #6599
parent 733ee4f4
...@@ -513,7 +513,8 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent ) ...@@ -513,7 +513,8 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
{ {
EvtDragDrop& evt = static_cast<EvtDragDrop&>(rEvent); EvtDragDrop& evt = static_cast<EvtDragDrop&>(rEvent);
Playtree& rPlaytree = static_cast<Playtree&>(m_rTree); 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(); m_itOver = m_rTree.end();
needRefresh = true; needRefresh = true;
} }
......
...@@ -283,15 +283,29 @@ void Playtree::insertItems( VarTree& elem, const list<string>& files, bool start ...@@ -283,15 +283,29 @@ void Playtree::insertItems( VarTree& elem, const list<string>& files, bool start
playlist_Lock( m_pPlaylist ); 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 ) if( p_elem->getId() == m_pPlaylist->p_local_category->i_id )
{ {
p_node = m_pPlaylist->p_local_category; p_node = m_pPlaylist->p_local_category;
i_pos = 0; i_pos = 0;
p_elem->setExpanded( true );
} }
else if( p_elem->getId() == m_pPlaylist->p_ml_category->i_id ) else if( p_elem->getId() == m_pPlaylist->p_ml_category->i_id )
{ {
p_node = m_pPlaylist->p_ml_category; p_node = m_pPlaylist->p_ml_category;
i_pos = 0; i_pos = 0;
p_elem->setExpanded( true );
} }
else if( p_elem->size() && p_elem->isExpanded() ) else if( p_elem->size() && p_elem->isExpanded() )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment