[vlc-commits] epg: hold input before lock access

Francois Cartegnie git at videolan.org
Sun Apr 10 16:16:57 CEST 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Apr  2 19:06:39 2011 +0200| [f1378a157e771df928917d524c2f0a03cc416704] | committer: Francois Cartegnie

epg: hold input before lock access

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

 modules/gui/qt4/dialogs/epg.cpp |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt4/dialogs/epg.cpp b/modules/gui/qt4/dialogs/epg.cpp
index 0a036ad..21ce324 100644
--- a/modules/gui/qt4/dialogs/epg.cpp
+++ b/modules/gui/qt4/dialogs/epg.cpp
@@ -27,6 +27,7 @@
 #include "dialogs/epg.hpp"
 
 #include "components/epg/EPGWidget.hpp"
+#include <vlc_playlist.h>
 
 #include <QVBoxLayout>
 #include <QSplitter>
@@ -119,7 +120,21 @@ void EpgDialog::showEvent( EPGItem *epgItem )
 void EpgDialog::updateInfos()
 {
     timer->stop();
-    if( !THEMIM->getInput() ) return;
-    epg->updateEPG( input_GetItem( THEMIM->getInput() ) );
-    if ( isVisible() ) timer->start();
+    input_item_t *p_input_item = NULL;
+    playlist_t *p_playlist = THEPL;
+    input_thread_t *p_input_thread = playlist_CurrentInput( p_playlist ); /* w/hold */
+    if( p_input_thread )
+    {
+        PL_LOCK; /* as input_GetItem still unfixed */
+        p_input_item = input_GetItem( p_input_thread );
+        if ( p_input_item ) vlc_gc_incref( p_input_item );
+        PL_UNLOCK;
+        vlc_object_release( p_input_thread );
+        if ( p_input_item )
+        {
+            epg->updateEPG( p_input_item );
+            vlc_gc_decref( p_input_item );
+            if ( isVisible() ) timer->start();
+        }
+    }
 }



More information about the vlc-commits mailing list