Commit 9279c339 authored by Francois Cartegnie's avatar Francois Cartegnie Committed by Jean-Baptiste Kempf

Qt: remove pointer from inputChanged signal (fix #11886 #11887)

All signals, event direct ones, are going to event loop.

Retrieves input_thread at event loop processing time

(cherry picked from commit ae4e524efdf503c3110a12c157aa489cc3428a2b)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 2900cc31
...@@ -480,7 +480,7 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, QWidget *parent ) ...@@ -480,7 +480,7 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, QWidget *parent )
/* Change the SpeedRate in the Label */ /* Change the SpeedRate in the Label */
CONNECT( THEMIM->getIM(), rateChanged( float ), this, setRate( float ) ); CONNECT( THEMIM->getIM(), rateChanged( float ), this, setRate( float ) );
DCONNECT( THEMIM, inputChanged( input_thread_t * ), DCONNECT( THEMIM, inputChanged( ),
speedControl, activateOnState() ); speedControl, activateOnState() );
setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
......
...@@ -61,8 +61,8 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */ ...@@ -61,8 +61,8 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
rebuild( p_root ); rebuild( p_root );
DCONNECT( THEMIM->getIM(), metaChanged( input_item_t *), DCONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
this, processInputItemUpdate( input_item_t *) ); this, processInputItemUpdate( input_item_t *) );
DCONNECT( THEMIM, inputChanged( input_thread_t * ), DCONNECT( THEMIM, inputChanged( ),
this, processInputItemUpdate( input_thread_t* ) ); this, processInputItemUpdate( ) );
CONNECT( THEMIM, playlistItemAppended( int, int ), CONNECT( THEMIM, playlistItemAppended( int, int ),
this, processItemAppend( int, int ) ); this, processItemAppend( int, int ) );
CONNECT( THEMIM, playlistItemRemoved( int ), CONNECT( THEMIM, playlistItemRemoved( int ),
...@@ -560,8 +560,9 @@ bool PLModel::canEdit() const ...@@ -560,8 +560,9 @@ bool PLModel::canEdit() const
/************************* Updates handling *****************************/ /************************* Updates handling *****************************/
/**** Events processing ****/ /**** Events processing ****/
void PLModel::processInputItemUpdate( input_thread_t *p_input ) void PLModel::processInputItemUpdate( )
{ {
input_thread_t *p_input = THEMIM->getInput();
if( !p_input ) return; if( !p_input ) return;
if( p_input && !( p_input->b_dead || !vlc_object_alive( p_input ) ) ) if( p_input && !( p_input->b_dead || !vlc_object_alive( p_input ) ) )
......
...@@ -157,7 +157,7 @@ private: ...@@ -157,7 +157,7 @@ private:
private slots: private slots:
void processInputItemUpdate( input_item_t *); void processInputItemUpdate( input_item_t *);
void processInputItemUpdate( input_thread_t* p_input ); void processInputItemUpdate();
void processItemRemoval( int i_pl_itemid ); void processItemRemoval( int i_pl_itemid );
void processItemAppend( int i_pl_itemid, int i_pl_itemidparent ); void processItemAppend( int i_pl_itemid, int i_pl_itemidparent );
void activateItem( playlist_item_t *p_item ); void activateItem( playlist_item_t *p_item );
......
...@@ -49,8 +49,8 @@ ExtensionsManager::ExtensionsManager( intf_thread_t *_p_intf, QObject *parent ) ...@@ -49,8 +49,8 @@ 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(), playingStatusChanged( int ), this, playingChanged( int ) ); CONNECT( THEMIM->getIM(), playingStatusChanged( int ), this, playingChanged( int ) );
DCONNECT( THEMIM, inputChanged( input_thread_t* ), DCONNECT( THEMIM, inputChanged( ),
this, inputChanged( input_thread_t* ) ); this, inputChanged( ) );
CONNECT( THEMIM->getIM(), metaChanged( input_item_t* ), CONNECT( THEMIM->getIM(), metaChanged( input_item_t* ),
this, metaChanged( input_item_t* ) ); this, metaChanged( input_item_t* ) );
b_unloading = false; b_unloading = false;
...@@ -264,8 +264,9 @@ void ExtensionsManager::triggerMenu( int id ) ...@@ -264,8 +264,9 @@ void ExtensionsManager::triggerMenu( int id )
} }
} }
void ExtensionsManager::inputChanged( input_thread_t* p_input ) void ExtensionsManager::inputChanged( )
{ {
input_thread_t* p_input = THEMIM->getInput();
//This is unlikely, but can happen if no extension modules can be loaded. //This is unlikely, but can happen if no extension modules can be loaded.
if ( p_extensions_manager == NULL ) if ( p_extensions_manager == NULL )
return ; return ;
......
...@@ -78,7 +78,7 @@ public slots: ...@@ -78,7 +78,7 @@ public slots:
private slots: private slots:
void triggerMenu( int id ); void triggerMenu( int id );
void inputChanged( input_thread_t *p_input ); void inputChanged( );
void playingChanged( int ); void playingChanged( int );
void metaChanged( input_item_t *p_input ); void metaChanged( input_item_t *p_input );
......
...@@ -99,6 +99,11 @@ InputManager::~InputManager() ...@@ -99,6 +99,11 @@ InputManager::~InputManager()
delInput(); delInput();
} }
void InputManager::inputChangedHandler()
{
setInput( THEMIM->getInput() );
}
/* Define the Input used. /* Define the Input used.
Add the callbacks on input Add the callbacks on input
p_input is held once here */ p_input is held once here */
...@@ -1017,13 +1022,13 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) ...@@ -1017,13 +1022,13 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf )
mute.addCallback( this, SLOT(notifyMute(bool)) ); mute.addCallback( this, SLOT(notifyMute(bool)) );
/* Warn our embedded IM about input changes */ /* Warn our embedded IM about input changes */
DCONNECT( this, inputChanged( input_thread_t * ), DCONNECT( this, inputChanged(),
im, setInput( input_thread_t * ) ); im, inputChangedHandler() );
/* initialize p_input (an input can already be running) */ /* initialize p_input (an input can already be running) */
p_input = playlist_CurrentInput( THEPL ); p_input = playlist_CurrentInput( THEPL );
if( p_input ) if( p_input )
emit inputChanged( p_input ); emit inputChanged( );
/* Audio Menu */ /* Audio Menu */
menusAudioMapper = new QSignalMapper(); menusAudioMapper = new QSignalMapper();
...@@ -1034,8 +1039,9 @@ MainInputManager::~MainInputManager() ...@@ -1034,8 +1039,9 @@ MainInputManager::~MainInputManager()
{ {
if( p_input ) if( p_input )
{ {
emit inputChanged( NULL );
vlc_object_release( p_input ); vlc_object_release( p_input );
p_input = NULL;
emit inputChanged( );
} }
var_DelCallback( THEPL, "activity", PLItemChanged, this ); var_DelCallback( THEPL, "activity", PLItemChanged, this );
...@@ -1090,7 +1096,7 @@ void MainInputManager::customEvent( QEvent *event ) ...@@ -1090,7 +1096,7 @@ void MainInputManager::customEvent( QEvent *event )
if( p_input != NULL ) if( p_input != NULL )
vlc_object_release( p_input ); vlc_object_release( p_input );
p_input = playlist_CurrentInput( THEPL ); p_input = playlist_CurrentInput( THEPL );
emit inputChanged( p_input ); emit inputChanged( );
} }
/* Playlist Control functions */ /* Playlist Control functions */
......
...@@ -183,8 +183,10 @@ private: ...@@ -183,8 +183,10 @@ private:
void UpdateProgramEvent(); void UpdateProgramEvent();
void UpdateEPG(); void UpdateEPG();
void setInput( input_thread_t * );
public slots: public slots:
void setInput( input_thread_t * ); ///< Our controlled input changed void inputChangedHandler(); ///< Our controlled input changed
void sliderUpdate( float ); ///< User dragged the slider. We get new pos void sliderUpdate( float ); ///< User dragged the slider. We get new pos
/* SpeedRate Rate Management */ /* SpeedRate Rate Management */
void reverse(); void reverse();
...@@ -309,7 +311,7 @@ private slots: ...@@ -309,7 +311,7 @@ private slots:
void menusUpdateAudio( const QString& ); void menusUpdateAudio( const QString& );
signals: signals:
void inputChanged( input_thread_t * ); void inputChanged( );
void volumeChanged( float ); void volumeChanged( float );
void soundMuteChanged( bool ); void soundMuteChanged( bool );
void playlistItemAppended( int itemId, int parentId ); void playlistItemAppended( int itemId, int parentId );
......
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