[vlc-devel] commit: Final fix for extensions+Qt unload issues ( Jean-Philippe André )

git version control git at videolan.org
Thu Feb 4 03:11:37 CET 2010


vlc | branch: master | Jean-Philippe André <jpeg at videolan.org> | Thu Feb  4 02:51:00 2010 +0100| [f2596fab9b100bf4392550b9f6596b09e76e2ad3] | committer: Jean-Philippe André 

Final fix for extensions+Qt unload issues

Well... I hope it is final :)

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

 modules/gui/qt4/dialogs/extensions.cpp |   14 +++++++++++---
 modules/gui/qt4/dialogs/extensions.hpp |    1 +
 modules/gui/qt4/extensions_manager.cpp |    1 +
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt4/dialogs/extensions.cpp b/modules/gui/qt4/dialogs/extensions.cpp
index e1740d9..b0b8dbf 100644
--- a/modules/gui/qt4/dialogs/extensions.cpp
+++ b/modules/gui/qt4/dialogs/extensions.cpp
@@ -37,6 +37,7 @@
 #include <QListWidget>
 #include <QComboBox>
 #include <QCloseEvent>
+#include <QCoreApplication>
 
 ExtensionsDialogProvider *ExtensionsDialogProvider::instance = NULL;
 
@@ -113,6 +114,7 @@ ExtensionDialog* ExtensionsDialogProvider::UpdateExtDialog(
     {
         dialog = CreateExtDialog( p_dialog );
         dialog->setVisible( !p_dialog->b_hide );
+        dialog->has_lock = false;
     }
     else if( !p_dialog->b_kill && dialog )
     {
@@ -172,11 +174,11 @@ ExtensionDialog::ExtensionDialog( intf_thread_t *_p_intf,
                                   extensions_manager_t *p_mgr,
                                   extension_dialog_t *_p_dialog )
          : QDialog( NULL ), p_intf( _p_intf ), p_extensions_manager( p_mgr )
-         , p_dialog( _p_dialog ), has_lock(false)
+         , p_dialog( _p_dialog ), has_lock(true)
 {
     assert( p_dialog );
     CONNECT( ExtensionsDialogProvider::getInstance(), destroyed(),
-             this, deleteLater() );
+             this, parentDestroyed() );
 
     msg_Dbg( p_intf, "Creating a new dialog: '%s'", p_dialog->psz_title );
 #if HAS_QT45
@@ -661,6 +663,12 @@ void ExtensionDialog::closeEvent( QCloseEvent *event )
     msg_Dbg( p_intf, "Dialog '%s' received a closeEvent",
              p_dialog->psz_title );
     extension_DialogClosed( p_dialog );
-    p_dialog->p_sys_intf = NULL;
 }
 
+void ExtensionDialog::parentDestroyed()
+{
+    msg_Dbg( p_intf, "About to destroy dialog '%s'", p_dialog->psz_title );
+    deleteLater(); // May not work at this point (event loop can be ended)
+    p_dialog->p_sys_intf = NULL;
+    vlc_cond_signal( &p_dialog->cond );
+}
diff --git a/modules/gui/qt4/dialogs/extensions.hpp b/modules/gui/qt4/dialogs/extensions.hpp
index 0313b46..d71a5a0 100644
--- a/modules/gui/qt4/dialogs/extensions.hpp
+++ b/modules/gui/qt4/dialogs/extensions.hpp
@@ -112,6 +112,7 @@ private slots:
     int TriggerClick( QObject *object );
     void SyncInput( QObject *object );
     void SyncSelection( QObject *object );
+    void parentDestroyed();
 
 signals:
     void destroyDialog( extension_dialog_t *p_dialog );
diff --git a/modules/gui/qt4/extensions_manager.cpp b/modules/gui/qt4/extensions_manager.cpp
index 653627c..bc7911c 100644
--- a/modules/gui/qt4/extensions_manager.cpp
+++ b/modules/gui/qt4/extensions_manager.cpp
@@ -55,6 +55,7 @@ ExtensionsManager::ExtensionsManager( intf_thread_t *_p_intf, QObject *parent )
 
 ExtensionsManager::~ExtensionsManager()
 {
+    msg_Dbg( p_intf, "Killing extension dialog provider" );
     ExtensionsDialogProvider::killInstance();
     if( p_extensions_manager )
     {




More information about the vlc-devel mailing list