qt4: do not access a widget from another thread
authorRafaël Carré <funman@videolan.org>
Fri, 12 Oct 2007 18:43:02 +0000 (18:43 +0000)
committerRafaël Carré <funman@videolan.org>
Fri, 12 Oct 2007 18:43:02 +0000 (18:43 +0000)
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp

index 1725545..3841ee0 100644 (file)
@@ -57,6 +57,7 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
     vlc_mutex_init( p_intf, &lock );
     p_vout = NULL;
     CONNECT( this, askResize(), this, SetMinSize() );
     vlc_mutex_init( p_intf, &lock );
     p_vout = NULL;
     CONNECT( this, askResize(), this, SetMinSize() );
+    CONNECT( this, askVideoToShow(), this, show() );
     setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
 }
 
     setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
 }
 
@@ -88,7 +89,7 @@ QSize VideoWidget::sizeHint() const
 void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
                            unsigned int *pi_width, unsigned int *pi_height )
 {
 void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
                            unsigned int *pi_width, unsigned int *pi_height )
 {
-    show();
+    emit askVideoToShow();
     if( p_vout )
     {
         msg_Dbg( p_intf, "embedded video already in use" );
     if( p_vout )
     {
         msg_Dbg( p_intf, "embedded video already in use" );
index 8e747ce..85dc19d 100644 (file)
@@ -66,6 +66,7 @@ private:
     vlc_mutex_t lock;
 signals:
     void askResize();
     vlc_mutex_t lock;
 signals:
     void askResize();
+    void askVideoToShow();
 private slots:
     void SetMinSize();
 };
 private slots:
     void SetMinSize();
 };