[vlc-commits] Qt4: use MTA apartment for COM (fixes #6880)

Rémi Denis-Courmont git at videolan.org
Fri Oct 12 10:43:32 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct  4 18:19:22 2012 +0300| [0bbd58595c84527fa7884df2a0bdc41f06d73df1] | committer: Rémi Denis-Courmont

Qt4: use MTA apartment for COM (fixes #6880)

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

 modules/access/dshow/dshow.cpp                    |    6 ++++--
 modules/gui/qt4/components/simple_preferences.cpp |    2 +-
 modules/gui/qt4/main_interface_win32.cpp          |    2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index d44aa2c..05b476c 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -2015,7 +2015,8 @@ static int FindDevices( vlc_object_t *p_this, const char *psz_name,
 {
     /* Find list of devices */
     list<string> list_devices;
-    if( SUCCEEDED(CoInitializeEx( NULL, COINIT_APARTMENTTHREADED )) )
+    if( SUCCEEDED(CoInitializeEx( NULL, COINIT_MULTITTHREADED ))
+     || SUCCEEDED(CoInitializeEx( NULL, COINIT_APARTMENTTHREADED )) )
     {
         bool b_audio = !strcmp( psz_name, CFG_PREFIX "adev" );
 
@@ -2055,7 +2056,8 @@ static int ConfigDevicesCallback( vlc_object_t *p_this, char const *psz_name,
     char *psz_device = NULL;
     int i_ret = VLC_SUCCESS;
 
-    if( FAILED(CoInitializeEx( NULL, COINIT_APARTMENTTHREADED )) )
+    if( FAILED(CoInitializeEx( NULL, COINIT_MULTITTHREADED ))
+     && FAILED(CoInitializeEx( NULL, COINIT_APARTMENTTHREADED )) )
         return VLC_EGENERIC;
 
     if( !EMPTY_STR( newval.psz_string ) )
diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp
index c19b30a..0c077df 100644
--- a/modules/gui/qt4/components/simple_preferences.cpp
+++ b/modules/gui/qt4/components/simple_preferences.cpp
@@ -935,7 +935,7 @@ bool SPrefsPanel::addType( const char * psz_ext, QTreeWidgetItem* current,
 void SPrefsPanel::assoDialog()
 {
     IApplicationAssociationRegistrationUI *p_appassoc;
-    CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
+    CoInitializeEx( NULL, COINIT_MULTITTHREADED );
 
     if( S_OK == CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI,
                 NULL, CLSCTX_INPROC_SERVER,
diff --git a/modules/gui/qt4/main_interface_win32.cpp b/modules/gui/qt4/main_interface_win32.cpp
index 5623cdd..42a9135 100644
--- a/modules/gui/qt4/main_interface_win32.cpp
+++ b/modules/gui/qt4/main_interface_win32.cpp
@@ -79,7 +79,7 @@ void MainInterface::createTaskBarButtons()
     FIXME:the play button's picture doesn't changed to pause when clicked
     */
 
-    CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
+    CoInitializeEx( NULL, COINIT_MULTITHREADED );
 
     if( S_OK == CoCreateInstance( CLSID_TaskbarList,
                 NULL, CLSCTX_INPROC_SERVER,



More information about the vlc-commits mailing list