]> git.sesse.net Git - vlc/commitdiff
Qt4: use explicit direct connections when passing VLC pointers...
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 1 Mar 2010 19:06:10 +0000 (21:06 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 1 Mar 2010 19:08:38 +0000 (21:08 +0200)
...without reference. With a direct connection, the call stack ensures
that the pointer remains valid until the slot returns. This is not the
case for asynchronous ("queued" in Qt4 documentation) signals.

Obviously, this means we have to emit the signals from the Qt4 main loop
thread, *or* alternatively not touch any Qt4 UI stuff fromt he slot.
Hopefully, any such bug would be easier to find this ways.

modules/gui/qt4/components/controller.cpp
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/playlist/playlist.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/selector.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/dialogs/mediainfo.cpp
modules/gui/qt4/extensions_manager.cpp
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/qt4.hpp

index 02866ff1235cb9f2d60be6f57ba489ff6f9a00d1..a0cfc942c3b8e77462a2df9baa3fb743b4daf84f 100644 (file)
@@ -682,8 +682,8 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWi
 
     vlc_mutex_init_recursive( &lock );
 
-    CONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ),
-             this, setVoutList( vout_thread_t **, int ) );
+    DCONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ),
+              this, setVoutList( vout_thread_t **, int ) );
 
     /* First Move */
     QRect rect1 = getSettings()->value( "FullScreen/screen" ).toRect();
index f700eb17dad9e7bc08b394a73efbf4f996508ad2..ba5b4a5535a6ff9a5f08a2d321015c16cc133f6c 100644 (file)
@@ -429,8 +429,8 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, const QString& text,
     /* Change the SpeedRate in the Status Bar */
     CONNECT( THEMIM->getIM(), rateChanged( int ), this, setRate( int ) );
 
-    CONNECT( THEMIM, inputChanged( input_thread_t * ),
-             speedControl, activateOnState() );
+    DCONNECT( THEMIM, inputChanged( input_thread_t * ),
+              speedControl, activateOnState() );
 }
 
 SpeedLabel::~SpeedLabel()
index 87e8c3d7bfcd3a928899756acfae61231c402f17..2d3ab03cf8d1af1e9303054b6487514b366d7084 100644 (file)
@@ -96,8 +96,8 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
     rightPanel = new StandardPLPanel( this, p_intf, THEPL, p_root );
 
     /* Connect the activation of the selector to a redefining of the PL */
-    CONNECT( selector, activated( playlist_item_t * ),
-             rightPanel, setRoot( playlist_item_t * ) );
+    DCONNECT( selector, activated( playlist_item_t * ),
+              rightPanel, setRoot( playlist_item_t * ) );
 
     rightPanel->setRoot( p_root );
 
index ebf78d7418df00503662b1d8fb0b0b5c87441a73..3f14247ed4fc28c89239d9cb6121ea8244200872 100644 (file)
@@ -89,10 +89,10 @@ PLModel::PLModel( playlist_t *_p_playlist,  /* THEPL */
 #undef ADD_ICON
 
     rebuild( p_root );
-    CONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
-            this, processInputItemUpdate( input_item_t *) );
-    CONNECT( THEMIM, inputChanged( input_thread_t * ),
-            this, processInputItemUpdate( input_thread_t* ) );
+    DCONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
+             this, processInputItemUpdate( input_item_t *) );
+    DCONNECT( THEMIM, inputChanged( input_thread_t * ),
+             this, processInputItemUpdate( input_thread_t* ) );
     CONNECT( THEMIM, playlistItemAppended( int, int ),
              this, processItemAppend( int, int ) );
     CONNECT( THEMIM, playlistItemRemoved( int ),
index 2b42401046d1936ec3cf0f57bcf92d00d9351a77..2e616800a364be627156cac8cda0e0f495dc4d09 100644 (file)
@@ -132,8 +132,8 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf )
              this, plItemAdded( int, int ) );
     CONNECT( THEMIM, playlistItemRemoved( int ),
              this, plItemRemoved( int ) );
-    CONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
-            this, inputItemUpdate( input_item_t * ) );
+    DCONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
+              this, inputItemUpdate( input_item_t * ) );
 
     createItems();
     CONNECT( this, itemActivated( QTreeWidgetItem *, int ),
index fbf38e31ee5a166026ae38cf92ae2400f34b2355..a508cb806d15f76103e1929c9ee130c430f90397 100644 (file)
@@ -123,8 +123,8 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
 
     getSettings()->endGroup();
 
-    CONNECT( THEMIM, leafBecameParent( input_item_t *),
-             this, browseInto( input_item_t * ) );
+    DCONNECT( THEMIM, leafBecameParent( input_item_t *),
+              this, browseInto( input_item_t * ) );
 
     CONNECT( model, currentChanged( const QModelIndex& ),
              this, handleExpansion( const QModelIndex& ) );
index 51e991aa9d39565d5990a2348edd7ec90e504b1a..930c9d4e4b054406dca00b6b589f7717e42bb317 100644 (file)
@@ -100,14 +100,14 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf,
          * Connects on the various signals of input_Manager
          * For the currently playing element
          **/
-        CONNECT( THEMIM->getIM(), infoChanged( input_item_t* ),
-                 IP, update( input_item_t* ) );
-        CONNECT( THEMIM->getIM(), currentMetaChanged( input_item_t* ),
-                 MP, update( input_item_t* ) );
-        CONNECT( THEMIM->getIM(), currentMetaChanged( input_item_t* ),
-                 EMP, update( input_item_t* ) );
-        CONNECT( THEMIM->getIM(), statisticsUpdated( input_item_t* ),
-                 ISP, update( input_item_t* ) );
+        DCONNECT( THEMIM->getIM(), infoChanged( input_item_t* ),
+                  IP, update( input_item_t* ) );
+        DCONNECT( THEMIM->getIM(), currentMetaChanged( input_item_t* ),
+                  MP, update( input_item_t* ) );
+        DCONNECT( THEMIM->getIM(), currentMetaChanged( input_item_t* ),
+                  EMP, update( input_item_t* ) );
+        DCONNECT( THEMIM->getIM(), statisticsUpdated( input_item_t* ),
+                  ISP, update( input_item_t* ) );
 
         if( THEMIM->getInput() )
             p_item = input_GetItem( THEMIM->getInput() );
index 236138dbb9733c13271022cacd6027a1a8fded01..b40d7fd1784365bc3f28a40c8ae6518b41f76b0a 100644 (file)
@@ -48,8 +48,8 @@ ExtensionsManager::ExtensionsManager( intf_thread_t *_p_intf, QObject *parent )
     menuMapper = new QSignalMapper( this );
     CONNECT( menuMapper, mapped( int ), this, triggerMenu( int ) );
     CONNECT( THEMIM->getIM(), statusChanged( int ), this, playingChanged( int ) );
-    CONNECT( THEMIM, inputChanged( input_thread_t* ),
-             this, inputChanged( input_thread_t* ) );
+    DCONNECT( THEMIM, inputChanged( input_thread_t* ),
+              this, inputChanged( input_thread_t* ) );
     b_unloading = false;
     b_failed = false;
 }
index 4edfc8285550b7357dc8e1df65be957154935df3..a648febfe7c932718cc28505650738af0d1877df 100644 (file)
@@ -918,8 +918,8 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf )
     var_AddCallback( THEPL, "volume-muted", SoundMuteChanged, this );
 
     /* Warn our embedded IM about input changes */
-    CONNECT( this, inputChanged( input_thread_t * ),
-             im, setInput( input_thread_t * ) );
+    DCONNECT( this, inputChanged( input_thread_t * ),
+              im, setInput( input_thread_t * ) );
 
     /* emit check if playlist has already started playing */
     input_thread_t *p_input = playlist_CurrentInput( THEPL );
index 15f8a3a909fda81d693d53509a1fcfc3e15737d5..91118398f4d8829b63b67e89129de028634a19e6 100644 (file)
@@ -94,7 +94,10 @@ struct intf_sys_t
 #define qtr( i ) QString::fromUtf8( vlc_gettext(i) )
 #define qtu( i ) ((i).toUtf8().constData())
 
-#define CONNECT( a, b, c, d ) connect( a, SIGNAL( b ), c, SLOT(d) )
+#define CONNECT( a, b, c, d ) \
+        connect( a, SIGNAL( b ), c, SLOT(d) )
+#define DCONNECT( a, b, c, d ) \
+        connect( a, SIGNAL( b ), c, SLOT(d), Qt::DirectConnection )
 #define BUTTONACT( b, a ) connect( b, SIGNAL( clicked() ), this, SLOT(a) )
 
 #define BUTTON_SET( button, text, tooltip )  \