[vlc-commits] Qt4: remove useless alive check on input

Rémi Denis-Courmont git at videolan.org
Mon Mar 25 21:51:24 CET 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar 25 22:48:55 2013 +0200| [060ad3a39bf9ec3f45fdd90a227076204aafa128] | committer: Rémi Denis-Courmont

Qt4: remove useless alive check on input

If the input dies, the state changes and the Qt input manager will
delete the input anyway.

Note that checking b_eof and b_dead here is also wrong (no memory
synchronization), but that is left for later.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=060ad3a39bf9ec3f45fdd90a227076204aafa128
---

 modules/gui/qt4/components/playlist/playlist_model.cpp |    8 +++-----
 modules/gui/qt4/input_manager.cpp                      |    3 +--
 modules/gui/qt4/input_manager.hpp                      |    3 +--
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index fcdc89b..13b51d6 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -648,11 +648,9 @@ bool PLModel::canEdit() const
 void PLModel::processInputItemUpdate( input_thread_t *p_input )
 {
     if( !p_input ) return;
-    if( p_input && !( p_input->b_dead || !vlc_object_alive( p_input ) ) )
-    {
-        PLItem *item = findByInput( rootItem, input_GetItem( p_input )->i_id );
-        if( item ) emit currentIndexChanged( index( item, 0 ) );
-    }
+
+    PLItem *item = findByInput( rootItem, input_GetItem( p_input )->i_id );
+    if( item ) emit currentIndexChanged( index( item, 0 ) );
     processInputItemUpdate( input_GetItem( p_input ) );
 }
 
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 15e996d..6707f7c 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -102,7 +102,7 @@ void InputManager::setInput( input_thread_t *_p_input )
 {
     delInput();
     p_input = _p_input;
-    if( p_input && !( p_input->b_dead || !vlc_object_alive (p_input) ) )
+    if( p_input != NULL )
     {
         msg_Dbg( p_intf, "IM: Setting an input" );
         vlc_object_hold( p_input );
@@ -119,7 +119,6 @@ void InputManager::setInput( input_thread_t *_p_input )
     }
     else
     {
-        p_input = NULL;
         p_item = NULL;
         assert( !p_input_vbi );
         emit rateChanged( var_InheritFloat( p_intf, "rate" ) );
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index 33648a3..7126cf1 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -133,8 +133,7 @@ public:
     {
         return p_input /* We have an input */
             && !p_input->b_dead /* not dead yet, */
-            && !p_input->b_eof  /* not EOF either, */
-            && vlc_object_alive (p_input); /* and the VLC object is alive */
+            && !p_input->b_eof  /* not EOF either */;
     }
 
     int playingStatus();



More information about the vlc-commits mailing list