]> git.sesse.net Git - vlc/commitdiff
qt4: delete the callbacks only if they already exist.
authorRémi Duraffort <ivoire@videolan.org>
Mon, 31 Aug 2009 08:15:51 +0000 (10:15 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Mon, 31 Aug 2009 08:15:51 +0000 (10:15 +0200)
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.hpp

index 0d5f7b56306b76f8ca0b4a70cc4ffb5cbdd75a42..91070f6a14918ed1807cabfb521f218eab4ae37f 100644 (file)
@@ -91,7 +91,7 @@ PLModel::PLModel( playlist_t *_p_playlist,  /* THEPL */
     ADD_ICON( NODE, ":/type/node" );
 #undef ADD_ICON
 
-    rebuild( p_root );
+    rebuild( p_root, true );
     CONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
             this, processInputItemUpdate( input_item_t *) );
     CONNECT( THEMIM, inputChanged( input_thread_t * ),
@@ -707,14 +707,18 @@ end:
 
 void PLModel::rebuild()
 {
-    rebuild( NULL );
+    rebuild( NULL, false );
 }
 
-void PLModel::rebuild( playlist_item_t *p_root )
+void PLModel::rebuild( playlist_item_t *p_root, bool b_first )
 {
     playlist_item_t* p_item;
-    /* Remove callbacks before locking to avoid deadlocks */
-    delCallbacks();
+    /* Remove callbacks before locking to avoid deadlocks
+       The first time the callbacks are not present so
+       don't try to delete them */
+    if( !b_first )
+        delCallbacks();
+
     /* Invalidate cache */
     i_cached_id = i_cached_input_id = -1;
 
index 2ff33321cb079a27960a9a83f5b5d6782a5df0f4..88f32adea91f689da2f1fc3cb395d6b5f05a184b 100644 (file)
@@ -125,7 +125,7 @@ public:
     void sort( int column, Qt::SortOrder order );
     void sort( int i_root_id, int column, Qt::SortOrder order );
     void removeItem( int );
-    void rebuild(); void rebuild( playlist_item_t * );
+    void rebuild(); void rebuild( playlist_item_t *, bool b_first = false );
 
 private: