[vlc-commits] Qt: remove pointer from inputChanged signal (fix #11886 #11887)

Francois Cartegnie git at videolan.org
Sun Aug 10 20:17:07 CEST 2014


vlc/vlc-2.2 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Aug  8 16:16:21 2014 +0900| [9279c339e0dd81129bd26531ae3cbc1e2b04710b] | committer: 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: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=9279c339e0dd81129bd26531ae3cbc1e2b04710b
---

 modules/gui/qt4/components/interface_widgets.cpp       |    2 +-
 modules/gui/qt4/components/playlist/playlist_model.cpp |    7 ++++---
 modules/gui/qt4/components/playlist/playlist_model.hpp |    2 +-
 modules/gui/qt4/extensions_manager.cpp                 |    7 ++++---
 modules/gui/qt4/extensions_manager.hpp                 |    2 +-
 modules/gui/qt4/input_manager.cpp                      |   16 +++++++++++-----
 modules/gui/qt4/input_manager.hpp                      |    6 ++++--
 7 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index aaf1975..fce3591 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -480,7 +480,7 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, QWidget *parent )
     /* Change the SpeedRate in the Label */
     CONNECT( THEMIM->getIM(), rateChanged( float ), this, setRate( float ) );
 
-    DCONNECT( THEMIM, inputChanged( input_thread_t * ),
+    DCONNECT( THEMIM, inputChanged( ),
               speedControl, activateOnState() );
 
     setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index f9d7f85..c318e0f 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -61,8 +61,8 @@ PLModel::PLModel( playlist_t *_p_playlist,  /* THEPL */
     rebuild( p_root );
     DCONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
               this, processInputItemUpdate( input_item_t *) );
-    DCONNECT( THEMIM, inputChanged( input_thread_t * ),
-              this, processInputItemUpdate( input_thread_t* ) );
+    DCONNECT( THEMIM, inputChanged( ),
+              this, processInputItemUpdate( ) );
     CONNECT( THEMIM, playlistItemAppended( int, int ),
              this, processItemAppend( int, int ) );
     CONNECT( THEMIM, playlistItemRemoved( int ),
@@ -560,8 +560,9 @@ bool PLModel::canEdit() const
 /************************* Updates handling *****************************/
 
 /**** 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 && !( p_input->b_dead || !vlc_object_alive( p_input ) ) )
diff --git a/modules/gui/qt4/components/playlist/playlist_model.hpp b/modules/gui/qt4/components/playlist/playlist_model.hpp
index 33cfd68..f9d1d0c 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.hpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.hpp
@@ -157,7 +157,7 @@ private:
 
 private slots:
     void processInputItemUpdate( input_item_t *);
-    void processInputItemUpdate( input_thread_t* p_input );
+    void processInputItemUpdate();
     void processItemRemoval( int i_pl_itemid );
     void processItemAppend( int i_pl_itemid, int i_pl_itemidparent );
     void activateItem( playlist_item_t *p_item );
diff --git a/modules/gui/qt4/extensions_manager.cpp b/modules/gui/qt4/extensions_manager.cpp
index 0c4cada..ec2959d 100644
--- a/modules/gui/qt4/extensions_manager.cpp
+++ b/modules/gui/qt4/extensions_manager.cpp
@@ -49,8 +49,8 @@ ExtensionsManager::ExtensionsManager( intf_thread_t *_p_intf, QObject *parent )
     menuMapper = new QSignalMapper( this );
     CONNECT( menuMapper, mapped( int ), this, triggerMenu( int ) );
     CONNECT( THEMIM->getIM(), playingStatusChanged( int ), this, playingChanged( int ) );
-    DCONNECT( THEMIM, inputChanged( input_thread_t* ),
-              this, inputChanged( input_thread_t* ) );
+    DCONNECT( THEMIM, inputChanged(  ),
+              this, inputChanged( ) );
     CONNECT( THEMIM->getIM(), metaChanged( input_item_t* ),
              this, metaChanged( input_item_t* ) );
     b_unloading = false;
@@ -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.
     if ( p_extensions_manager == NULL )
         return ;
diff --git a/modules/gui/qt4/extensions_manager.hpp b/modules/gui/qt4/extensions_manager.hpp
index a2b38f7..729c937 100644
--- a/modules/gui/qt4/extensions_manager.hpp
+++ b/modules/gui/qt4/extensions_manager.hpp
@@ -78,7 +78,7 @@ public slots:
 
 private slots:
     void triggerMenu( int id );
-    void inputChanged( input_thread_t *p_input );
+    void inputChanged( );
     void playingChanged( int );
     void metaChanged( input_item_t *p_input );
 
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index f72b3b3..d76fdd5 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -99,6 +99,11 @@ InputManager::~InputManager()
     delInput();
 }
 
+void InputManager::inputChangedHandler()
+{
+    setInput( THEMIM->getInput() );
+}
+
 /* Define the Input used.
    Add the callbacks on input
    p_input is held once here */
@@ -1017,13 +1022,13 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf )
     mute.addCallback( this, SLOT(notifyMute(bool)) );
 
     /* Warn our embedded IM about input changes */
-    DCONNECT( this, inputChanged( input_thread_t * ),
-              im, setInput( input_thread_t * ) );
+    DCONNECT( this, inputChanged(),
+              im, inputChangedHandler() );
 
     /* initialize p_input (an input can already be running) */
     p_input = playlist_CurrentInput( THEPL );
     if( p_input )
-        emit inputChanged( p_input );
+        emit inputChanged( );
 
     /* Audio Menu */
     menusAudioMapper = new QSignalMapper();
@@ -1034,8 +1039,9 @@ MainInputManager::~MainInputManager()
 {
     if( p_input )
     {
-       emit inputChanged( NULL );
        vlc_object_release( p_input );
+       p_input = NULL;
+       emit inputChanged( );
     }
 
     var_DelCallback( THEPL, "activity", PLItemChanged, this );
@@ -1090,7 +1096,7 @@ void MainInputManager::customEvent( QEvent *event )
     if( p_input != NULL )
         vlc_object_release( p_input );
     p_input = playlist_CurrentInput( THEPL );
-    emit inputChanged( p_input );
+    emit inputChanged( );
 }
 
 /* Playlist Control functions */
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index dac3bc3..af66ee0 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -183,8 +183,10 @@ private:
     void UpdateProgramEvent();
     void UpdateEPG();
 
+    void setInput( input_thread_t * );
+
 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
     /* SpeedRate Rate Management */
     void reverse();
@@ -309,7 +311,7 @@ private slots:
     void menusUpdateAudio( const QString& );
 
 signals:
-    void inputChanged( input_thread_t * );
+    void inputChanged( );
     void volumeChanged( float );
     void soundMuteChanged( bool );
     void playlistItemAppended( int itemId, int parentId );



More information about the vlc-commits mailing list