Commit 5ebb3da9 authored by Jean-Baptiste Kempf's avatar 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
parent 13bfe4cc
...@@ -60,14 +60,12 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, ...@@ -60,14 +60,12 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
layout->setSpacing( 0 ); layout->setMargin( 0 ); layout->setSpacing( 0 ); layout->setMargin( 0 );
setMinimumWidth( 300 ); setMinimumWidth( 300 );
model = new PLModel( p_playlist, p_intf, p_root, this );
CONNECT( model, currentChanged( const QModelIndex& ),
this, handleExpansion( const QModelIndex& ) );
iconView = NULL; iconView = NULL;
treeView = NULL; treeView = NULL;
model = new PLModel( p_playlist, p_intf, p_root, this );
currentRootId = -1; currentRootId = -1;
last_activated_id = -1;
/* Title label */ /* Title label */
/*title = new QLabel; /*title = new QLabel;
...@@ -132,9 +130,11 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, ...@@ -132,9 +130,11 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
getSettings()->endGroup(); getSettings()->endGroup();
last_activated_id = -1;
CONNECT( THEMIM, inputChanged( input_thread_t * ), CONNECT( THEMIM, inputChanged( input_thread_t * ),
this, handleInputChange( input_thread_t * ) ); this, handleInputChange( input_thread_t * ) );
CONNECT( model, currentChanged( const QModelIndex& ),
this, handleExpansion( const QModelIndex& ) );
} }
StandardPLPanel::~StandardPLPanel() StandardPLPanel::~StandardPLPanel()
......
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