wx/playlist.cpp: invalidate the FindItem cache when needed (should fix some random crashes)

parent f258f621
...@@ -374,7 +374,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -374,7 +374,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
SetDropTarget( new DragAndDrop( p_intf, VLC_TRUE ) ); SetDropTarget( new DragAndDrop( p_intf, VLC_TRUE ) );
#endif #endif
i_saved_id = 0; i_saved_id = -1;
/* We want to be noticed of playlist changes */ /* We want to be noticed of playlist changes */
...@@ -610,6 +610,7 @@ void Playlist::UpdateItem( int i ) ...@@ -610,6 +610,7 @@ void Playlist::UpdateItem( int i )
void Playlist::RemoveItem( int i ) void Playlist::RemoveItem( int i )
{ {
if( i <= 0 ) return; /* Sanity check */ if( i <= 0 ) return; /* Sanity check */
if( i == i_saved_id ) i_saved_id = -1;
wxTreeItemId item = FindItem( treectrl->GetRootItem(), i ); wxTreeItemId item = FindItem( treectrl->GetRootItem(), i );
...@@ -768,6 +769,7 @@ void Playlist::Rebuild( vlc_bool_t b_root ) ...@@ -768,6 +769,7 @@ void Playlist::Rebuild( vlc_bool_t b_root )
/* ...and rebuild it */ /* ...and rebuild it */
LockPlaylist( p_intf->p_sys, p_playlist ); LockPlaylist( p_intf->p_sys, p_playlist );
} }
i_saved_id = -1;
p_view = playlist_ViewFind( p_playlist, i_current_view ); /* FIXME */ p_view = playlist_ViewFind( p_playlist, i_current_view ); /* FIXME */
...@@ -1383,6 +1385,7 @@ void Playlist::OnPopupSort( wxCommandEvent& event ) ...@@ -1383,6 +1385,7 @@ void Playlist::OnPopupSort( wxCommandEvent& event )
SORT_TITLE_NODES_FIRST, ORDER_NORMAL ); SORT_TITLE_NODES_FIRST, ORDER_NORMAL );
treectrl->DeleteChildren( i_wx_popup_item ); treectrl->DeleteChildren( i_wx_popup_item );
i_saved_id = -1;
UpdateNodeChildren( p_item, i_wx_popup_item ); UpdateNodeChildren( p_item, i_wx_popup_item );
} }
......
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