[vlc-devel] commit: qt4: delete the callbacks only if they already exist. ( Rémi Duraffort )

git version control git at videolan.org
Mon Aug 31 10:19:04 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Aug 31 10:15:51 2009 +0200| [bfb26c0ea72b8a7466afe486cf578aaee60df76a] | committer: Rémi Duraffort 

qt4: delete the callbacks only if they already exist.

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

 .../gui/qt4/components/playlist/playlist_model.cpp |   14 +++++++++-----
 .../gui/qt4/components/playlist/playlist_model.hpp |    2 +-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 0d5f7b5..91070f6 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -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;
 
diff --git a/modules/gui/qt4/components/playlist/playlist_model.hpp b/modules/gui/qt4/components/playlist/playlist_model.hpp
index 2ff3332..88f32ad 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.hpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.hpp
@@ -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:
 




More information about the vlc-devel mailing list