[Libreoffice-commits] core.git: avmedia/source connectivity/source cui/source dbaccess/source dtrans/source dtrans/test extensions/source extensions/test fpicker/source shell/source vcl/win
Julien Nabet (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 22 20:22:51 UTC 2020
avmedia/source/win/framegrabber.cxx | 2 +-
avmedia/source/win/player.cxx | 2 +-
connectivity/source/drivers/ado/ADriver.cxx | 2 +-
cui/source/options/optgdlg.cxx | 2 +-
dbaccess/source/ui/dlg/adodatalinks.cxx | 4 ++--
dtrans/source/win32/clipb/MtaOleClipb.cxx | 6 +++---
dtrans/source/win32/workbench/test_wincb.cxx | 2 +-
dtrans/test/win32/dnd/dndTest.cxx | 4 ++--
extensions/source/config/WinUserInfo/WinUserInfoBe.cxx | 2 +-
extensions/source/update/check/updatecheck.cxx | 2 +-
extensions/test/ole/OleClient/clientTest.cxx | 4 ++--
extensions/test/ole/OleConverterVar1/convTest.cxx | 4 ++--
extensions/test/ole/cppToUno/testcppuno.cxx | 4 ++--
extensions/test/ole/cpptest/cpptest.cxx | 2 +-
extensions/test/ole/unoTocomCalls/Test/Test.cpp | 4 ++--
fpicker/source/win32/VistaFilePickerImpl.cxx | 2 +-
shell/source/win32/SysShExec.cxx | 2 +-
vcl/win/app/salinst.cxx | 2 +-
18 files changed, 26 insertions(+), 26 deletions(-)
New commits:
commit b587de60d4e6aa96238766272d94f1499b22f696
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Fri May 22 14:33:24 2020 +0200
Commit: Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Fri May 22 22:22:15 2020 +0200
Prefer CoInitializeEx instead of CoInitialize
As https://docs.microsoft.com/fr-fr/windows/win32/api/objbase/nf-objbase-coinitialize?redirectedfrom=MSDN
advised.
Moreover, it'll make concurrency model explicit
Change-Id: I247a49248bf45beb64a7985a7c0d078ee48efe2d
Change-Id: I6e755fd516d9fb2dd2a9df0c66d9afd6070447ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94669
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/avmedia/source/win/framegrabber.cxx b/avmedia/source/win/framegrabber.cxx
index 09f5a6409616..21b5dede6866 100644
--- a/avmedia/source/win/framegrabber.cxx
+++ b/avmedia/source/win/framegrabber.cxx
@@ -50,7 +50,7 @@ namespace avmedia::win {
FrameGrabber::FrameGrabber( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
mxMgr( rxMgr )
{
- ::CoInitialize( nullptr );
+ ::CoInitializeEx( nullptr, COINIT_APARTMENTTHREADED );
}
diff --git a/avmedia/source/win/player.cxx b/avmedia/source/win/player.cxx
index 50323bb80725..8e08d9e53b90 100644
--- a/avmedia/source/win/player.cxx
+++ b/avmedia/source/win/player.cxx
@@ -80,7 +80,7 @@ Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
mbLooping( false ),
mbAddWindow( true )
{
- ::CoInitialize( nullptr );
+ ::CoInitializeEx( nullptr, COINIT_APARTMENTTHREADED );
}
diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx
index f8afdde132c0..926a818eebb2 100644
--- a/connectivity/source/drivers/ado/ADriver.cxx
+++ b/connectivity/source/drivers/ado/ADriver.cxx
@@ -58,7 +58,7 @@ ODriver::ODriver(const css::uno::Reference< css::lang::XMultiServiceFactory >& _
ODriver::~ODriver()
{
CoUninitialize();
- CoInitialize(nullptr);
+ CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
}
void ODriver::disposing()
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 8c9210474ce7..34bd6857142d 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -473,7 +473,7 @@ IMPL_LINK_NOARG( OfaMiscTabPage, TwoFigureHdl, weld::SpinButton&, void )
#if defined(_WIN32)
IMPL_STATIC_LINK_NOARG(OfaMiscTabPage, FileAssocClick, weld::Button&, void)
{
- const bool bUninit = SUCCEEDED(CoInitialize(nullptr));
+ const bool bUninit = SUCCEEDED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED));
IApplicationAssociationRegistrationUI* pIf = nullptr;
HRESULT res = CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI, nullptr,
CLSCTX_INPROC_SERVER, IID_IApplicationAssociationRegistrationUI,
diff --git a/dbaccess/source/ui/dlg/adodatalinks.cxx b/dbaccess/source/ui/dlg/adodatalinks.cxx
index fa237caa33ac..fc129b2dea33 100644
--- a/dbaccess/source/ui/dlg/adodatalinks.cxx
+++ b/dbaccess/source/ui/dlg/adodatalinks.cxx
@@ -42,7 +42,7 @@ OUString PromptNew(long hWnd)
BSTR _result=nullptr;
// Initialize COM
- ::CoInitialize( nullptr );
+ ::CoInitializeEx( nullptr, COINIT_APARTMENTTHREADED );
// Instantiate DataLinks object.
hr = CoCreateInstance(
@@ -96,7 +96,7 @@ OUString PromptEdit(long hWnd, OUString const & connstr)
BSTR _result=nullptr;
// Initialize COM
- ::CoInitialize( nullptr );
+ ::CoInitializeEx( nullptr, COINIT_APARTMENTTHREADED );
hr = CoCreateInstance(CLSID_CADOConnection,
nullptr,
diff --git a/dtrans/source/win32/clipb/MtaOleClipb.cxx b/dtrans/source/win32/clipb/MtaOleClipb.cxx
index de966c3978c3..2fdc2d7f9641 100644
--- a/dtrans/source/win32/clipb/MtaOleClipb.cxx
+++ b/dtrans/source/win32/clipb/MtaOleClipb.cxx
@@ -179,14 +179,14 @@ class CAutoComInit
{
public:
/*
- to be safe we call CoInitialize
+ to be safe we call CoInitializeEx
although it is not necessary if
the calling thread was created
using osl_CreateThread because
- this function calls CoInitialize
+ this function calls CoInitializeEx
for every thread it creates
*/
- CAutoComInit( ) : m_hResult( CoInitialize( nullptr ) )
+ CAutoComInit( ) : m_hResult( CoInitializeEx( nullptr, COINIT_APARTMENTTHREADED ) )
{
if ( S_OK == m_hResult )
OSL_FAIL(
diff --git a/dtrans/source/win32/workbench/test_wincb.cxx b/dtrans/source/win32/workbench/test_wincb.cxx
index 8a2f25fd4ccc..96839e22a49a 100644
--- a/dtrans/source/win32/workbench/test_wincb.cxx
+++ b/dtrans/source/win32/workbench/test_wincb.cxx
@@ -206,7 +206,7 @@ int SAL_CALL main( int nArgc, char* Argv[] )
// threaded apartment we need a message loop to deliver
// messages to our XTDataObject
//HRESULT hr = CoInitializeEx( NULL, COINIT_MULTITHREADED );
- (void)CoInitialize( NULL );
+ (void)CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
char buff[6];
diff --git a/dtrans/test/win32/dnd/dndTest.cxx b/dtrans/test/win32/dnd/dndTest.cxx
index 3a022d98758d..2f2a7bccfc68 100644
--- a/dtrans/test/win32/dnd/dndTest.cxx
+++ b/dtrans/test/win32/dnd/dndTest.cxx
@@ -56,9 +56,9 @@ Reference< XMultiServiceFactory > MultiServiceFactory;
int main( int argc, char *argv[ ], char *envp[ ] )
{
HRESULT hr;
- if( FAILED( hr=CoInitialize(NULL )))
+ if( FAILED( hr=CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
{
- printf("CoInitialize failed \n");
+ printf("CoInitializeEx failed \n");
return -1;
}
diff --git a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx
index a7732fa196fd..f9ebaca1edd7 100644
--- a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx
+++ b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx
@@ -92,7 +92,7 @@ public:
{
CoInitializeGuard()
{
- if (FAILED(CoInitialize(nullptr)))
+ if (FAILED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED)))
throw css::uno::RuntimeException();
}
~CoInitializeGuard() { CoUninitialize(); }
diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx
index ad7251da2c3d..a4e18c193046 100644
--- a/extensions/source/update/check/updatecheck.cxx
+++ b/extensions/source/update/check/updatecheck.cxx
@@ -585,7 +585,7 @@ DownloadThread::run()
#ifdef _WIN32
CoUninitialize();
- CoInitialize( nullptr );
+ CoInitializeEx( nullptr, COINIT_APARTMENTTHREADED );
#endif
while( schedule() )
diff --git a/extensions/test/ole/OleClient/clientTest.cxx b/extensions/test/ole/OleClient/clientTest.cxx
index 675b2a66d09c..00a78034d1d9 100644
--- a/extensions/test/ole/OleClient/clientTest.cxx
+++ b/extensions/test/ole/OleClient/clientTest.cxx
@@ -72,9 +72,9 @@ void printSequence( Sequence<Any>& val);
extern "C" int SAL_CALL main( int , char **)
{
HRESULT hr;
- if( FAILED( hr=CoInitialize(NULL)))
+ if( FAILED( hr=CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
{
- _tprintf(_T("CoInitialize failed \n"));
+ _tprintf(_T("CoInitializeEx failed \n"));
return -1;
}
diff --git a/extensions/test/ole/OleConverterVar1/convTest.cxx b/extensions/test/ole/OleConverterVar1/convTest.cxx
index c0acc3152abf..8fc27177e56b 100644
--- a/extensions/test/ole/OleConverterVar1/convTest.cxx
+++ b/extensions/test/ole/OleConverterVar1/convTest.cxx
@@ -65,9 +65,9 @@ void printVariant( VARIANT & var);
int SAL_CALL main( int argc, char* argv[] )
{
HRESULT hr;
- if( FAILED( hr=CoInitialize(NULL)))
+ if( FAILED( hr=CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
{
- printf("CoInitialize failed \n");
+ printf("CoInitializeEx failed \n");
return -1;
}
diff --git a/extensions/test/ole/cppToUno/testcppuno.cxx b/extensions/test/ole/cppToUno/testcppuno.cxx
index 563e2d0acc06..e64541ed2fc0 100644
--- a/extensions/test/ole/cppToUno/testcppuno.cxx
+++ b/extensions/test/ole/cppToUno/testcppuno.cxx
@@ -51,9 +51,9 @@ bool incrementMultidimensionalIndex(
int SAL_CALL main( int /*argc*/, char** /*argv*/ )
{
HRESULT hr;
- if( FAILED( hr=CoInitialize(NULL)))
+ if( FAILED( hr=CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
{
- printf("CoInitialize failed \n");
+ printf("CoInitializeEx failed \n");
return -1;
}
diff --git a/extensions/test/ole/cpptest/cpptest.cxx b/extensions/test/ole/cpptest/cpptest.cxx
index d97489847399..ec1592587ee2 100644
--- a/extensions/test/ole/cpptest/cpptest.cxx
+++ b/extensions/test/ole/cpptest/cpptest.cxx
@@ -33,7 +33,7 @@ HRESULT doTest();
int main(int /*argc*/, char** /*argv*/)
{
HRESULT hr;
- if( FAILED( hr=CoInitialize(NULL)))
+ if( FAILED( hr=CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
{
printf("CoInitialize failed \n");
return -1;
diff --git a/extensions/test/ole/unoTocomCalls/Test/Test.cpp b/extensions/test/ole/unoTocomCalls/Test/Test.cpp
index afed02a31d10..b10900dbcd63 100644
--- a/extensions/test/ole/unoTocomCalls/Test/Test.cpp
+++ b/extensions/test/ole/unoTocomCalls/Test/Test.cpp
@@ -32,9 +32,9 @@ HRESULT doTest();
int main(int argc, char* argv[])
{
HRESULT hr;
- if( FAILED( hr=CoInitialize(NULL)))
+ if( FAILED( hr=CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
{
- _tprintf(_T("CoInitialize failed \n"));
+ _tprintf(_T("CoInitializeEx failed \n"));
return -1;
}
diff --git a/fpicker/source/win32/VistaFilePickerImpl.cxx b/fpicker/source/win32/VistaFilePickerImpl.cxx
index b4829126a0f6..c84fe5f3a72d 100644
--- a/fpicker/source/win32/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/VistaFilePickerImpl.cxx
@@ -209,7 +209,7 @@ void VistaFilePickerImpl::before()
// by VCL and UNO so. There is no way to change that from outside...
// but we need a STA environment...
// So we make it by try-and-error...
- // If first CoInitialize will fail... we uninitialize COM initialize it new .-)
+ // If first CoInitializeEx will fail... we uninitialize COM initialize it new .-)
m_hLastResult = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
if ( FAILED(m_hLastResult) )
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index 874c4f5e94cf..93eeaee36f03 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -156,7 +156,7 @@ CSysShExec::CSysShExec( const css::uno::Reference< css::uno::XComponentContext >
* Once this changed, we can remove the uninitialize call.
*/
CoUninitialize();
- CoInitialize( nullptr );
+ CoInitializeEx( nullptr, COINIT_APARTMENTTHREADED );
}
namespace
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 179a134204e9..5ebb22226eff 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -310,7 +310,7 @@ SalData::SalData()
SetSalData( this );
initNWF();
- CoInitialize(nullptr); // put main thread in Single Threaded Apartment (STA)
+ CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); // put main thread in Single Threaded Apartment (STA)
static Gdiplus::GdiplusStartupInput gdiplusStartupInput;
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr);
}
More information about the Libreoffice-commits
mailing list