[vlc-devel] commit: Qt: try to avoid a potential race condition (Jean-Baptiste Kempf )

git version control git at videolan.org
Fri Jan 29 12:33:22 CET 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Jan 29 12:31:42 2010 +0100| [5ebb3da913cfe7aa14201eb86321cd5a9dc7978d] | committer: Jean-Baptiste Kempf 

Qt: try to avoid a potential race condition

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

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

 .../gui/qt4/components/playlist/standardpanel.cpp  |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index a514736..998e9d0 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -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()




More information about the vlc-devel mailing list