Commit 88d39cee authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: use explicit direct connections when passing VLC pointers...

...without reference. With a direct connection, the call stack ensures
that the pointer remains valid until the slot returns. This is not the
case for asynchronous ("queued" in Qt4 documentation) signals.

Obviously, this means we have to emit the signals from the Qt4 main loop
thread, *or* alternatively not touch any Qt4 UI stuff fromt he slot.
Hopefully, any such bug would be easier to find this ways.
parent 9bd636a7
...@@ -682,7 +682,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWi ...@@ -682,7 +682,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWi
vlc_mutex_init_recursive( &lock ); vlc_mutex_init_recursive( &lock );
CONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ), DCONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ),
this, setVoutList( vout_thread_t **, int ) ); this, setVoutList( vout_thread_t **, int ) );
/* First Move */ /* First Move */
......
...@@ -429,7 +429,7 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, const QString& text, ...@@ -429,7 +429,7 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, const QString& text,
/* Change the SpeedRate in the Status Bar */ /* Change the SpeedRate in the Status Bar */
CONNECT( THEMIM->getIM(), rateChanged( int ), this, setRate( int ) ); CONNECT( THEMIM->getIM(), rateChanged( int ), this, setRate( int ) );
CONNECT( THEMIM, inputChanged( input_thread_t * ), DCONNECT( THEMIM, inputChanged( input_thread_t * ),
speedControl, activateOnState() ); speedControl, activateOnState() );
} }
......
...@@ -96,7 +96,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) ...@@ -96,7 +96,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
rightPanel = new StandardPLPanel( this, p_intf, THEPL, p_root ); rightPanel = new StandardPLPanel( this, p_intf, THEPL, p_root );
/* Connect the activation of the selector to a redefining of the PL */ /* Connect the activation of the selector to a redefining of the PL */
CONNECT( selector, activated( playlist_item_t * ), DCONNECT( selector, activated( playlist_item_t * ),
rightPanel, setRoot( playlist_item_t * ) ); rightPanel, setRoot( playlist_item_t * ) );
rightPanel->setRoot( p_root ); rightPanel->setRoot( p_root );
......
...@@ -89,9 +89,9 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */ ...@@ -89,9 +89,9 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
#undef ADD_ICON #undef ADD_ICON
rebuild( p_root ); rebuild( p_root );
CONNECT( THEMIM->getIM(), metaChanged( input_item_t *), DCONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
this, processInputItemUpdate( input_item_t *) ); this, processInputItemUpdate( input_item_t *) );
CONNECT( THEMIM, inputChanged( input_thread_t * ), DCONNECT( THEMIM, inputChanged( input_thread_t * ),
this, processInputItemUpdate( input_thread_t* ) ); this, processInputItemUpdate( input_thread_t* ) );
CONNECT( THEMIM, playlistItemAppended( int, int ), CONNECT( THEMIM, playlistItemAppended( int, int ),
this, processItemAppend( int, int ) ); this, processItemAppend( int, int ) );
......
...@@ -132,7 +132,7 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf ) ...@@ -132,7 +132,7 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf )
this, plItemAdded( int, int ) ); this, plItemAdded( int, int ) );
CONNECT( THEMIM, playlistItemRemoved( int ), CONNECT( THEMIM, playlistItemRemoved( int ),
this, plItemRemoved( int ) ); this, plItemRemoved( int ) );
CONNECT( THEMIM->getIM(), metaChanged( input_item_t *), DCONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
this, inputItemUpdate( input_item_t * ) ); this, inputItemUpdate( input_item_t * ) );
createItems(); createItems();
......
...@@ -123,7 +123,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, ...@@ -123,7 +123,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
getSettings()->endGroup(); getSettings()->endGroup();
CONNECT( THEMIM, leafBecameParent( input_item_t *), DCONNECT( THEMIM, leafBecameParent( input_item_t *),
this, browseInto( input_item_t * ) ); this, browseInto( input_item_t * ) );
CONNECT( model, currentChanged( const QModelIndex& ), CONNECT( model, currentChanged( const QModelIndex& ),
......
...@@ -100,13 +100,13 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, ...@@ -100,13 +100,13 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf,
* Connects on the various signals of input_Manager * Connects on the various signals of input_Manager
* For the currently playing element * For the currently playing element
**/ **/
CONNECT( THEMIM->getIM(), infoChanged( input_item_t* ), DCONNECT( THEMIM->getIM(), infoChanged( input_item_t* ),
IP, update( input_item_t* ) ); IP, update( input_item_t* ) );
CONNECT( THEMIM->getIM(), currentMetaChanged( input_item_t* ), DCONNECT( THEMIM->getIM(), currentMetaChanged( input_item_t* ),
MP, update( input_item_t* ) ); MP, update( input_item_t* ) );
CONNECT( THEMIM->getIM(), currentMetaChanged( input_item_t* ), DCONNECT( THEMIM->getIM(), currentMetaChanged( input_item_t* ),
EMP, update( input_item_t* ) ); EMP, update( input_item_t* ) );
CONNECT( THEMIM->getIM(), statisticsUpdated( input_item_t* ), DCONNECT( THEMIM->getIM(), statisticsUpdated( input_item_t* ),
ISP, update( input_item_t* ) ); ISP, update( input_item_t* ) );
if( THEMIM->getInput() ) if( THEMIM->getInput() )
......
...@@ -48,7 +48,7 @@ ExtensionsManager::ExtensionsManager( intf_thread_t *_p_intf, QObject *parent ) ...@@ -48,7 +48,7 @@ ExtensionsManager::ExtensionsManager( intf_thread_t *_p_intf, QObject *parent )
menuMapper = new QSignalMapper( this ); menuMapper = new QSignalMapper( this );
CONNECT( menuMapper, mapped( int ), this, triggerMenu( int ) ); CONNECT( menuMapper, mapped( int ), this, triggerMenu( int ) );
CONNECT( THEMIM->getIM(), statusChanged( int ), this, playingChanged( int ) ); CONNECT( THEMIM->getIM(), statusChanged( int ), this, playingChanged( int ) );
CONNECT( THEMIM, inputChanged( input_thread_t* ), DCONNECT( THEMIM, inputChanged( input_thread_t* ),
this, inputChanged( input_thread_t* ) ); this, inputChanged( input_thread_t* ) );
b_unloading = false; b_unloading = false;
b_failed = false; b_failed = false;
......
...@@ -918,7 +918,7 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) ...@@ -918,7 +918,7 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf )
var_AddCallback( THEPL, "volume-muted", SoundMuteChanged, this ); var_AddCallback( THEPL, "volume-muted", SoundMuteChanged, this );
/* Warn our embedded IM about input changes */ /* Warn our embedded IM about input changes */
CONNECT( this, inputChanged( input_thread_t * ), DCONNECT( this, inputChanged( input_thread_t * ),
im, setInput( input_thread_t * ) ); im, setInput( input_thread_t * ) );
/* emit check if playlist has already started playing */ /* emit check if playlist has already started playing */
......
...@@ -94,7 +94,10 @@ struct intf_sys_t ...@@ -94,7 +94,10 @@ struct intf_sys_t
#define qtr( i ) QString::fromUtf8( vlc_gettext(i) ) #define qtr( i ) QString::fromUtf8( vlc_gettext(i) )
#define qtu( i ) ((i).toUtf8().constData()) #define qtu( i ) ((i).toUtf8().constData())
#define CONNECT( a, b, c, d ) connect( a, SIGNAL( b ), c, SLOT(d) ) #define CONNECT( a, b, c, d ) \
connect( a, SIGNAL( b ), c, SLOT(d) )
#define DCONNECT( a, b, c, d ) \
connect( a, SIGNAL( b ), c, SLOT(d), Qt::DirectConnection )
#define BUTTONACT( b, a ) connect( b, SIGNAL( clicked() ), this, SLOT(a) ) #define BUTTONACT( b, a ) connect( b, SIGNAL( clicked() ), this, SLOT(a) )
#define BUTTON_SET( button, text, tooltip ) \ #define BUTTON_SET( button, text, tooltip ) \
......
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