[Libreoffice-commits] core.git: connectivity/source
Julien Nabet (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jun 5 15:26:11 UTC 2020
connectivity/source/drivers/ado/ADriver.cxx | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
New commits:
commit acd091002cdb3373672b6ee8600b1818d02df31d
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Fri Jun 5 15:37:20 2020 +0200
Commit: Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Fri Jun 5 17:25:29 2020 +0200
Use o3tl::safeCoInitializeEx/safeCoUninitializeReinit (ado)
Change-Id: I8eaa5c0f91a5e78888f6a2edea13fa5d2227fb9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95598
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
Tested-by: Jenkins
diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx
index 4ec59deeee36..3fc5ce763103 100644
--- a/connectivity/source/drivers/ado/ADriver.cxx
+++ b/connectivity/source/drivers/ado/ADriver.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <connectivity/dbexception.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <o3tl/safeCoInitUninit.hxx>
#include <strings.hrc>
#include <objbase.h>
@@ -47,28 +48,12 @@ ODriver::ODriver(const css::uno::Reference< css::lang::XMultiServiceFactory >& _
,m_xORB(_xORB)
,mnNbCallCoInitializeExForReinit(0)
{
- HRESULT hr;
- while ((hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED)) == RPC_E_CHANGED_MODE)
- {
- // so we're in RPC_E_CHANGED_MODE case
- // the pb was it was already initialized with COINIT_MULTITHREADED
- // close this init
- CoUninitialize();
- // and increment counter for dtr part
- ++mnNbCallCoInitializeExForReinit;
-
- // and keep on the loop if there were multi initializations
- }
- if (FAILED(hr))
- std::abort();
+ o3tl::safeCoInitializeEx(COINIT_APARTMENTTHREADED, mnNbCallCoInitializeExForReinit);
}
ODriver::~ODriver()
{
- CoUninitialize();
- // Put back all the inits, if there were, before the use of ADO
- for (int i = 0; i < mnNbCallCoInitializeExForReinit; ++i)
- CoInitializeEx(nullptr, COINIT_MULTITHREADED);
+ o3tl::safeCoUninitializeReinit(COINIT_MULTITHREADED, mnNbCallCoInitializeExForReinit);
}
void ODriver::disposing()
More information about the Libreoffice-commits
mailing list