[Libreoffice-commits] core.git: connectivity/source dbaccess/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Jul 29 21:05:58 UTC 2018


 connectivity/source/drivers/file/FTable.cxx |   14 +++-----------
 dbaccess/source/core/api/RowSet.cxx         |   14 +++-----------
 dbaccess/source/core/api/table.cxx          |   14 +++-----------
 3 files changed, 9 insertions(+), 33 deletions(-)

New commits:
commit 1eeb8d34760e63c0ab2b52a27f43141bcde84297
Author:     Jochen Nitschke <j.nitschke+logerrit at ok.de>
AuthorDate: Sun Jul 29 18:22:19 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jul 29 23:05:31 2018 +0200

    replace double checked locking patterns
    
    with thread safe static initialization
    
    Change-Id: I7b102e8a6aec64b0795f5fa915276ffc1f568d0a
    Reviewed-on: https://gerrit.libreoffice.org/58288
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx
index e583e20db9af..0c805dbae645 100644
--- a/connectivity/source/drivers/file/FTable.cxx
+++ b/connectivity/source/drivers/file/FTable.cxx
@@ -124,17 +124,9 @@ void SAL_CALL OFileTable::disposing()
 
 Sequence< sal_Int8 > OFileTable::getUnoTunnelImplementationId()
 {
-    static ::cppu::OImplementationId * pId = nullptr;
-    if (! pId)
-    {
-        ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-        if (! pId)
-        {
-            static ::cppu::OImplementationId aId;
-            pId = &aId;
-        }
-    }
-    return pId->getImplementationId();
+    static ::cppu::OImplementationId s_Id;
+
+    return s_Id.getImplementationId();
 }
 
 // css::lang::XUnoTunnel
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 0ce715ed1a8a..69414a73b34f 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -456,17 +456,9 @@ sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId )
 
 Sequence< sal_Int8 > ORowSet::getUnoTunnelImplementationId()
 {
-    static ::cppu::OImplementationId * pId = nullptr;
-    if (! pId)
-    {
-        ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-        if (! pId)
-        {
-            static ::cppu::OImplementationId aId;
-            pId = &aId;
-        }
-    }
-    return pId->getImplementationId();
+    static ::cppu::OImplementationId s_Id;
+
+    return s_Id.getImplementationId();
 }
 
 // css::XAggregation
diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx
index 3590e93613aa..348c61ded3ac 100644
--- a/dbaccess/source/core/api/table.cxx
+++ b/dbaccess/source/core/api/table.cxx
@@ -312,17 +312,9 @@ sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId )
 
 Sequence< sal_Int8 > ODBTable::getUnoTunnelImplementationId()
 {
-    static ::cppu::OImplementationId * pId = nullptr;
-    if (! pId)
-    {
-        ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-        if (! pId)
-        {
-            static ::cppu::OImplementationId aId;
-            pId = &aId;
-        }
-    }
-    return pId->getImplementationId();
+    static ::cppu::OImplementationId s_Id;
+
+    return s_Id.getImplementationId();
 }
 
 Reference< XPropertySet > ODBTable::createColumnDescriptor()


More information about the Libreoffice-commits mailing list