[Libreoffice-commits] core.git: dtrans/source extensions/test

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Fri May 29 08:42:05 UTC 2020


 dtrans/source/win32/clipb/MtaOleClipb.cxx |    6 +++---
 extensions/test/ole/cpptest/cpptest.cxx   |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit c1aab4ca12f8e3b68240d064d82cf72ccb527648
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Fri May 29 09:01:07 2020 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Fri May 29 10:41:24 2020 +0200

    Prefer CoInitializeEx instead of CoInitialize (2)
    
    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: I8eaa7c0ba4e0c5131b178596cf5310df92ff41ce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95093
    Tested-by: Julien Nabet <serval2412 at yahoo.fr>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/dtrans/source/win32/clipb/MtaOleClipb.cxx b/dtrans/source/win32/clipb/MtaOleClipb.cxx
index 70fce3bc64ad..0e57b5ab1442 100644
--- a/dtrans/source/win32/clipb/MtaOleClipb.cxx
+++ b/dtrans/source/win32/clipb/MtaOleClipb.cxx
@@ -200,10 +200,10 @@ public:
     {
         /*
             we only call CoUninitialize when
-            CoInitialize returned S_FALSE, what
+            CoInitializeEx returned S_FALSE, what
             means that com was already initialize
             for that thread so we keep the balance
-            if CoInitialize returned S_OK what means
+            if CoInitializeEx returned S_OK what means
             com was not yet initialized we better
             let com initialized or we may run into
             the realm of undefined behaviour
@@ -678,7 +678,7 @@ unsigned int WINAPI CMtaOleClipboard::clipboardChangedNotifierThreadProc( LPVOID
     CMtaOleClipboard* pInst = static_cast< CMtaOleClipboard* >( pParam );
     OSL_ASSERT( nullptr != pInst );
 
-    CoInitialize( nullptr );
+    CoInitializeEx( nullptr, COINIT_APARTMENTTHREADED );
 
     // assuming we don't need a lock for
     // a boolean variable like m_bRun...
diff --git a/extensions/test/ole/cpptest/cpptest.cxx b/extensions/test/ole/cpptest/cpptest.cxx
index ec1592587ee2..f87a0663d192 100644
--- a/extensions/test/ole/cpptest/cpptest.cxx
+++ b/extensions/test/ole/cpptest/cpptest.cxx
@@ -35,7 +35,7 @@ int main(int /*argc*/, char** /*argv*/)
     HRESULT hr;
     if( FAILED( hr=CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
     {
-        printf("CoInitialize failed \n");
+        printf("CoInitializeEx failed \n");
         return -1;
     }
 


More information about the Libreoffice-commits mailing list