[Libreoffice-commits] .: 2 commits - sc/qa sc/source

Caolán McNamara caolan at kemper.freedesktop.org
Mon Apr 4 06:30:53 PDT 2011


 sc/qa/unit/makefile.mk           |    1 
 sc/qa/unit/ucalc.cxx             |    1 
 sc/source/ui/unoobj/afmtuno.cxx  |   20 +++-------
 sc/source/ui/unoobj/cellsuno.cxx |   36 ++++++-------------
 sc/source/ui/unoobj/dapiuno.cxx  |   19 +++-------
 sc/source/ui/unoobj/datauno.cxx  |   19 +++-------
 sc/source/ui/unoobj/docuno.cxx   |   18 +++------
 sc/source/ui/unoobj/fielduno.cxx |   36 ++++++-------------
 sc/source/ui/unoobj/fmtuno.cxx   |   37 +++++++-------------
 sc/source/ui/unoobj/nameuno.cxx  |   20 ++++------
 sc/source/ui/unoobj/scdetect.cxx |    1 
 sc/source/ui/unoobj/srchuno.cxx  |   20 +++-------
 sc/source/ui/unoobj/styleuno.cxx |   18 +++------
 sc/source/ui/unoobj/textuno.cxx  |   72 +++++++++++++--------------------------
 sc/source/ui/unoobj/viewuno.cxx  |   18 +++------
 15 files changed, 116 insertions(+), 220 deletions(-)

New commits:
commit bad301d3d6e8e9bc0783334e165e3790ec200c1b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 4 12:52:23 2011 +0100

    use rtl::Static where double-locked pattern used

diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx
index 7bf9c56..75a704e 100644
--- a/sc/source/ui/unoobj/afmtuno.cxx
+++ b/sc/source/ui/unoobj/afmtuno.cxx
@@ -39,7 +39,7 @@
 #include <vcl/svapp.hxx>
 #include <svx/unomid.hxx>
 #include "unowids.hxx"
-#include <rtl/uuid.h>
+#include <comphelper/servicehelper.hxx>
 #include <com/sun/star/table/BorderLine.hpp>
 #include <com/sun/star/table/CellVertJustify2.hpp>
 #include <com/sun/star/table/ShadowLocation.hpp>
@@ -470,20 +470,14 @@ sal_Int64 SAL_CALL ScAutoFormatObj::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScAutoFormatObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScAutoFormatObjUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScAutoFormatObj::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScAutoFormatObjUnoTunnelId::get().getSeq();
 }
 
 ScAutoFormatObj* ScAutoFormatObj::getImplementation(
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 8e7475d..3273ab0 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -4086,20 +4086,14 @@ sal_Int64 SAL_CALL ScCellRangesBase::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScCellRangesBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScCellRangesBaseUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScCellRangesBase::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScCellRangesBaseUnoTunnelId::get().getSeq();
 }
 
 ScCellRangesBase* ScCellRangesBase::getImplementation( const uno::Reference<uno::XInterface> xObj )
@@ -8695,20 +8689,14 @@ sal_Int64 SAL_CALL ScTableSheetObj::getSomething(
     return ScCellRangeObj::getSomething( rId );
 }
 
+namespace
+{
+    class theScTableSheetObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTableSheetObjUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScTableSheetObj::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScTableSheetObjUnoTunnelId::get().getSeq();
 }
 
 ScTableSheetObj* ScTableSheetObj::getImplementation( const uno::Reference<uno::XInterface> xObj )
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 9095d6e..e0b3fd6 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -64,6 +64,7 @@
 
 #include <comphelper/extract.hxx>
 #include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
 
 using namespace com::sun::star;
 using namespace com::sun::star::sheet;
@@ -1093,20 +1094,14 @@ sal_Int64 SAL_CALL ScDataPilotDescriptorBase::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScDataPilotDescriptorBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScDataPilotDescriptorBaseUnoTunnelId> {};
+}
+
 const Sequence<sal_Int8>& ScDataPilotDescriptorBase::getUnoTunnelId()
 {
-    static Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScDataPilotDescriptorBaseUnoTunnelId::get().getSeq();
 }
 
 ScDataPilotDescriptorBase* ScDataPilotDescriptorBase::getImplementation(
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index edc7fea..8b79c0b 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -63,6 +63,7 @@
 #include "attrib.hxx"
 #include "dpshttab.hxx"
 #include <comphelper/extract.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <svx/dataaccessdescriptor.hxx>
 
 using namespace com::sun::star;
@@ -842,20 +843,14 @@ sal_Int64 SAL_CALL ScSubTotalDescriptorBase::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScSubTotalDescriptorBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScSubTotalDescriptorBaseUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScSubTotalDescriptorBase::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScSubTotalDescriptorBaseUnoTunnelId::get().getSeq();
 }
 
 ScSubTotalDescriptorBase* ScSubTotalDescriptorBase::getImplementation(
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index f0e964b..72acd2d 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2080,20 +2080,14 @@ sal_Int64 SAL_CALL ScModelObj::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScModelObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScModelObjUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScModelObj::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScModelObjUnoTunnelId::get().getSeq();
 }
 
 ScModelObj* ScModelObj::getImplementation( const uno::Reference<uno::XInterface> xObj )
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 7e3d45e..0242d1b 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -801,20 +801,14 @@ sal_Int64 SAL_CALL ScCellFieldObj::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScCellFieldObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScCellFieldObjUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScCellFieldObj::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScCellFieldObjUnoTunnelId::get().getSeq();
 }
 
 ScCellFieldObj* ScCellFieldObj::getImplementation(
@@ -1455,20 +1449,14 @@ sal_Int64 SAL_CALL ScHeaderFieldObj::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScHeaderFieldObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScHeaderFieldObjUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScHeaderFieldObj::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScHeaderFieldObjUnoTunnelId::get().getSeq();
 }
 
 ScHeaderFieldObj* ScHeaderFieldObj::getImplementation(
diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx
index e88369e..7e1694d 100644
--- a/sc/source/ui/unoobj/fmtuno.cxx
+++ b/sc/source/ui/unoobj/fmtuno.cxx
@@ -34,6 +34,7 @@
 #include <tools/debug.hxx>
 #include <rtl/uuid.h>
 #include <vcl/svapp.hxx>
+#include <comphelper/servicehelper.hxx>
 
 #include <com/sun/star/sheet/ValidationAlertStyle.hpp>
 #include <com/sun/star/sheet/ValidationType.hpp>
@@ -521,20 +522,14 @@ sal_Int64 SAL_CALL ScTableConditionalFormat::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScTableConditionalFormatUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTableConditionalFormatUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScTableConditionalFormat::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScTableConditionalFormatUnoTunnelId::get().getSeq();
 }
 
 ScTableConditionalFormat* ScTableConditionalFormat::getImplementation(
@@ -1057,20 +1052,14 @@ sal_Int64 SAL_CALL ScTableValidationObj::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScTableValidationObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTableValidationObjUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScTableValidationObj::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScTableValidationObjUnoTunnelId::get().getSeq();
 }
 
 ScTableValidationObj* ScTableValidationObj::getImplementation(
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index 52d9006..d392c9b 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -38,6 +38,8 @@
 #include <com/sun/star/awt/XBitmap.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 
+#include <comphelper/servicehelper.hxx>
+
 using namespace ::com::sun::star;
 using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::Any;
@@ -457,20 +459,14 @@ sal_Int64 SAL_CALL ScNamedRangeObj::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScNamedRangeObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScNamedRangeObjUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScNamedRangeObj::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScNamedRangeObjUnoTunnelId::get().getSeq();
 }
 
 ScNamedRangeObj* ScNamedRangeObj::getImplementation( const uno::Reference<uno::XInterface> xObj )
diff --git a/sc/source/ui/unoobj/srchuno.cxx b/sc/source/ui/unoobj/srchuno.cxx
index d849b88..c5cea9d 100644
--- a/sc/source/ui/unoobj/srchuno.cxx
+++ b/sc/source/ui/unoobj/srchuno.cxx
@@ -35,7 +35,7 @@
 #include <svl/srchitem.hxx>
 #include <vcl/svapp.hxx>
 #include <osl/mutex.hxx>
-#include <rtl/uuid.h>
+#include <comphelper/servicehelper.hxx>
 
 #include "srchuno.hxx"
 #include "docsh.hxx"
@@ -242,20 +242,14 @@ sal_Int64 SAL_CALL ScCellSearchObj::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScCellSearchObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScCellSearchObjUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScCellSearchObj::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScCellSearchObjUnoTunnelId::get().getSeq();
 }
 
 ScCellSearchObj* ScCellSearchObj::getImplementation(
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 7674ef7..e0244b8 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -1130,20 +1130,14 @@ sal_Int64 SAL_CALL ScStyleObj::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScStyleObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScStyleObjUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScStyleObj::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScStyleObjUnoTunnelId::get().getSeq();
 }
 
 ScStyleObj* ScStyleObj::getImplementation(
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index dbb901f..0716f9d 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -200,20 +200,14 @@ sal_Int64 SAL_CALL ScHeaderFooterContentObj::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScHeaderFooterContentObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScHeaderFooterContentObjUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScHeaderFooterContentObj::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScHeaderFooterContentObjUnoTunnelId::get().getSeq();
 }
 
 ScHeaderFooterContentObj* ScHeaderFooterContentObj::getImplementation(
@@ -692,20 +686,14 @@ sal_Int64 SAL_CALL ScCellTextCursor::getSomething(
     return SvxUnoTextCursor::getSomething( rId );
 }
 
+namespace
+{
+    class theScCellTextCursorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScCellTextCursorUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScCellTextCursor::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScCellTextCursorUnoTunnelId::get().getSeq();
 }
 
 ScCellTextCursor* ScCellTextCursor::getImplementation( const uno::Reference<uno::XInterface> xObj )
@@ -794,20 +782,14 @@ sal_Int64 SAL_CALL ScHeaderFooterTextCursor::getSomething(
     return SvxUnoTextCursor::getSomething( rId );
 }
 
+namespace
+{
+    class theScHeaderFooterTextCursorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScHeaderFooterTextCursorUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScHeaderFooterTextCursor::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScHeaderFooterTextCursorUnoTunnelId::get().getSeq();
 }
 
 ScHeaderFooterTextCursor* ScHeaderFooterTextCursor::getImplementation(
@@ -896,20 +878,14 @@ sal_Int64 SAL_CALL ScDrawTextCursor::getSomething(
     return SvxUnoTextCursor::getSomething( rId );
 }
 
+namespace
+{
+    class theScDrawTextCursorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScDrawTextCursorUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScDrawTextCursor::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScDrawTextCursorUnoTunnelId::get().getSeq();
 }
 
 ScDrawTextCursor* ScDrawTextCursor::getImplementation( const uno::Reference<uno::XInterface> xObj )
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 3e78f42..d87eedb 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -2306,20 +2306,14 @@ sal_Int64 SAL_CALL ScTabViewObj::getSomething(
     return 0;
 }
 
+namespace
+{
+    class theScTabViewObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTabViewObjUnoTunnelId> {};
+}
+
 const uno::Sequence<sal_Int8>& ScTabViewObj::getUnoTunnelId()
 {
-    static uno::Sequence<sal_Int8> * pSeq = 0;
-    if( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theScTabViewObjUnoTunnelId::get().getSeq();
 }
 
 ScTabViewObj* ScTabViewObj::getImplementation( const uno::Reference<uno::XInterface> xObj )
commit 4a5b75c207df7d450b5a5aa893062ae14beb1c0e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 4 12:20:01 2011 +0100

    that's a completely pointless getGlobalMutex acquisition

diff --git a/sc/qa/unit/makefile.mk b/sc/qa/unit/makefile.mk
index d252433..1f8e93a 100644
--- a/sc/qa/unit/makefile.mk
+++ b/sc/qa/unit/makefile.mk
@@ -71,7 +71,6 @@ SHL1STDLIBS=       \
 SHL1IMPLIB = i$(SHL1TARGET)
 SHL1LIBS=$(SLB)$/scalc3.lib $(SLB)$/scalc3c.lib 
 DEF1NAME = $(SHL1TARGET)
-SHL1VERSIONMAP=version.map
 
 .INCLUDE: target.mk
 
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index b5f2542..2e6d1b4 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1623,6 +1623,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
 
+#define CPPUNIT_PLUGIN_EXPORT extern "C" SAL_DLLPUBLIC_EXPORT
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index b405958..178197f 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -876,7 +876,6 @@ UNOSEQUENCE< UNOOUSTRING > SAL_CALL ScFilterDetect::getSupportedServiceNames() t
 /* Helper for XServiceInfo */
 UNOSEQUENCE< UNOOUSTRING > ScFilterDetect::impl_getStaticSupportedServiceNames()
 {
-    UNOMUTEXGUARD aGuard( UNOMUTEX::getGlobalMutex() );
     UNOSEQUENCE< UNOOUSTRING > seqServiceNames( 1 );
     seqServiceNames.getArray() [0] = UNOOUSTRING(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ExtendedTypeDetection"  ));
     return seqServiceNames ;


More information about the Libreoffice-commits mailing list