]> git.sesse.net Git - vlc/commitdiff
Qt: try to avoid a potential race condition
authorJean-Baptiste Kempf <jb@videolan.org>
Fri, 29 Jan 2010 11:31:42 +0000 (12:31 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 29 Jan 2010 11:31:42 +0000 (12:31 +0100)
If we receive a currentChanged, and currentView ain't set, we might crash in
handleExpansion

Crashes have happened at
StandardPLPanel::handleExpansion (this=<value optimized out>, index=@0x406b56a0) at
components/playlist/standardpanel.cpp

modules/gui/qt4/components/playlist/standardpanel.cpp

index a5147366b96b70fdcb40a5a188ab51a9c4b2b6dd..998e9d052084bce96b77b3c8caa306c5f2cd31f8 100644 (file)
@@ -60,14 +60,12 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
     layout->setSpacing( 0 ); layout->setMargin( 0 );
     setMinimumWidth( 300 );
 
-    model = new PLModel( p_playlist, p_intf, p_root, this );
-    CONNECT( model, currentChanged( const QModelIndex& ),
-             this, handleExpansion( const QModelIndex& ) );
-
     iconView = NULL;
     treeView = NULL;
 
+    model = new PLModel( p_playlist, p_intf, p_root, this );
     currentRootId = -1;
+    last_activated_id = -1;
 
     /* Title label */
     /*title = new QLabel;
@@ -132,9 +130,11 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
 
     getSettings()->endGroup();
 
-    last_activated_id = -1;
     CONNECT( THEMIM, inputChanged( input_thread_t * ),
              this, handleInputChange( input_thread_t * ) );
+
+    CONNECT( model, currentChanged( const QModelIndex& ),
+             this, handleExpansion( const QModelIndex& ) );
 }
 
 StandardPLPanel::~StandardPLPanel()