[vlc-devel] commit: Fixed qt4 initialization/destruction. (Laurent Aimar )

git version control git at videolan.org
Mon Jan 5 21:26:46 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Dec 27 18:47:15 2008 +0100| [0780928c1a7c8eb4a1b10e5248c89443dbbb4bc0] | committer: Laurent Aimar 

Fixed qt4 initialization/destruction.

It should fix a few issues with embed video and fullscreen controler (the
widget may? not yet be ready in time).
It fixes dialog provider.

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

 modules/gui/qt4/components/playlist/playlist.cpp |    1 +
 modules/gui/qt4/dialogs_provider.cpp             |    4 --
 modules/gui/qt4/main_interface.cpp               |    3 +
 modules/gui/qt4/qt4.cpp                          |   51 +++++++--------------
 4 files changed, 21 insertions(+), 38 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index 5ac5f83..293f30c 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -148,6 +148,7 @@ void PlaylistWidget::closeEvent( QCloseEvent *event )
 {
     if( THEDP->isDying() )
     {
+        /* FIXME is it needed ? */
         close();
     }
     else
diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp
index 29dbad3..9d7b5de 100644
--- a/modules/gui/qt4/dialogs_provider.cpp
+++ b/modules/gui/qt4/dialogs_provider.cpp
@@ -97,12 +97,8 @@ DialogsProvider::~DialogsProvider()
 
 void DialogsProvider::quit()
 {
-    /* Stop the playlist */
-    playlist_Stop( THEPL );
     b_isDying = true;
     vlc_object_kill( p_intf->p_libvlc );
-    QApplication::closeAllWindows();
-    QApplication::quit();
 }
 
 void DialogsProvider::customEvent( QEvent *event )
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index dc55bc5..7fcf069 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -1074,6 +1074,9 @@ void MainInterface::closeEvent( QCloseEvent *e )
 {
     hide();
     THEDP->quit();
+
+    QApplication::closeAllWindows();
+    QApplication::quit();
 }
 
 void MainInterface::toggleFullScreen( void )
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 615bfac..44b2ed8 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -264,23 +264,22 @@ static int Open( vlc_object_t *p_this )
     p_sys->p_playlist = pl_Hold( p_intf );
     p_sys->p_mi = NULL;
 
-    if (vlc_clone (&p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW))
+    if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
     {
         pl_Release (p_sys->p_playlist);
         delete p_sys;
         return VLC_ENOMEM;
     }
-    else
-    {
-        QMutexLocker locker (&iface.lock);
-        vlc_value_t val;
 
-        while (p_sys->p_mi == NULL)
-            iface.ready.wait (&iface.lock);
-        var_Create (p_this->p_libvlc, "qt4-iface", VLC_VAR_ADDRESS);
-        val.p_address = p_this;
-        var_Set (p_this->p_libvlc, "qt4-iface", val);
-    }
+    /* */
+    QMutexLocker locker (&iface.lock);
+    vlc_value_t val;
+
+    while( p_sys->p_mi == NULL && !p_sys->b_isDialogProvider )
+        iface.ready.wait( &iface.lock );
+    var_Create (p_this->p_libvlc, "qt4-iface", VLC_VAR_ADDRESS);
+    val.p_address = p_this;
+    var_Set (p_this->p_libvlc, "qt4-iface", val);
     return VLC_SUCCESS;
 }
 
@@ -304,17 +303,6 @@ static void Close( vlc_object_t *p_this )
     var_Destroy (p_this->p_libvlc, "qt4-iface");
     QApplication::postEvent (p_sys->p_mi, new QCloseEvent());
 
-    if( p_intf->p_sys->b_isDialogProvider )
-    {
-        if( DialogsProvider::isAlive() )
-        {
-            msg_Dbg( p_intf, "Asking the DP to quit nicely" );
-            DialogEvent *event = new DialogEvent( INTF_DIALOG_EXIT, 0, NULL );
-            QApplication::postEvent( THEDP, static_cast<QEvent*>(event) );
-        }
-        vlc_thread_join( p_intf );
-    }
-
     vlc_join (p_sys->thread, NULL);
     pl_Release (p_this);
     delete p_sys;
@@ -386,21 +374,16 @@ static void *Thread( void *obj )
 
     /* Create the normal interface in non-DP mode */
     if( !p_intf->pf_show_dialog )
-    {
         p_mi = new MainInterface( p_intf );
-        /* We don't show it because it is done in the MainInterface constructor
-        p_mi->show(); */
-
-        QMutexLocker locker (&iface.lock);
-        p_intf->p_sys->p_mi = p_mi;
-        iface.ready.wakeAll ();
-    }
     else
-    {
-        vlc_thread_ready( p_intf );
-        p_intf->p_sys->b_isDialogProvider = true;
         p_mi = NULL;
-    }
+
+    /* */
+    iface.lock.lock();
+    p_intf->p_sys->p_mi = p_mi;
+    p_intf->p_sys->b_isDialogProvider = p_mi == NULL;
+    iface.ready.wakeAll();
+    iface.lock.unlock();
 
     /* Explain to the core how to show a dialog :D */
     p_intf->pf_show_dialog = ShowDialog;




More information about the vlc-devel mailing list