[vlc-commits] qt4: Fix initial input probing

Hugo Beauzée-Luyssen git at videolan.org
Thu Dec 10 16:17:41 CET 2015


vlc/vlc-2.2 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Dec 10 15:01:47 2015 +0100| [95877a9cc187ddc27f0eb19f4579c88c1ac7ae8b] | committer: Hugo Beauzée-Luyssen

qt4: Fix initial input probing

inputChangedHandler only reads from the current MIM input, which isn't
set until the next playlist callback is received.
This actively probes the current input, sets it, and inform potential
listeners
refs #14162

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/gui/qt4/input_manager.cpp |    4 ++++
 modules/gui/qt4/input_manager.hpp |    3 +++
 modules/gui/qt4/qt4.cpp           |    7 ++-----
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index bd99dec..707f114 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -1108,7 +1108,11 @@ void MainInputManager::customEvent( QEvent *event )
     default:
         if( type != IMEvent::ItemChanged ) return;
     }
+    probeCurrentInput();
+}
 
+void MainInputManager::probeCurrentInput()
+{
     if( p_input != NULL )
         vlc_object_release( p_input );
     p_input = playlist_CurrentInput( THEPL );
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index b696884..d9edcb6 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -276,6 +276,9 @@ public:
     bool hasEmptyPlaylist();
 
     void requestVoutUpdate() { return im->UpdateVout(); }
+    // Probe for initial input. Doing this from the constructor would cause
+    // the getInstance to call itself recursively from the inputChangedHandler
+    void probeCurrentInput();
 
 protected:
     QSignalMapper *menusAudioMapper;
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 966e784..36e43f0 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -507,11 +507,8 @@ static void *Thread( void *obj )
 
     /* Initialize the Dialog Provider and the Main Input Manager */
     DialogsProvider::getInstance( p_intf );
-    MainInputManager *mim = MainInputManager::getInstance( p_intf );
-    /* initialize p_input (an input can already be running) */
-    input_thread_t *p_input = playlist_CurrentInput( THEPL );
-    if( p_input )
-        mim->getIM()->inputChangedHandler();
+    MainInputManager* mim = MainInputManager::getInstance( p_intf );
+    mim->probeCurrentInput();
 
 #ifdef UPDATE_CHECK
     /* Checking for VLC updates */



More information about the vlc-commits mailing list