[Libreoffice-commits] core.git: 2 commits - framework/Library_fwk.mk framework/source sal/osl

Noel Grandin noel at peralex.com
Fri Jul 11 06:44:49 PDT 2014


 framework/Library_fwk.mk                              |    1 
 framework/source/uiconfiguration/imagemanagerimpl.cxx |   28 ++----------------
 framework/source/uiconfiguration/imagemanagerimpl.hxx |   10 +-----
 sal/osl/unx/mutex.c                                   |    2 -
 4 files changed, 8 insertions(+), 33 deletions(-)

New commits:
commit 1fc3126439ca57a0c1c4897770e77281c5f325c3
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jul 11 15:44:00 2014 +0200

    convert GlobalImageList to SimpleReferenceObject
    
    instead of hand-rolling it's own reference counting
    
    Change-Id: Ie90cdce49b9dab68f1bdf487b0f308e03464f893

diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk
index abfc7a9..74e72a9 100644
--- a/framework/Library_fwk.mk
+++ b/framework/Library_fwk.mk
@@ -45,6 +45,7 @@ $(eval $(call gb_Library_use_libraries,fwk,\
     fwi \
     i18nlangtag \
     sal \
+    salhelper \
     sot \
     svl \
     svt \
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index 2e974e8..1c55653 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -310,13 +310,15 @@ bool CmdImageList::hasImage( sal_Int16 /*nImageType*/, const OUString& rCommandU
 }
 
 GlobalImageList::GlobalImageList( const uno::Reference< uno::XComponentContext >& rxContext ) :
-    CmdImageList( rxContext, OUString() ),
-    m_nRefCount( 0 )
+    CmdImageList( rxContext, OUString() )
 {
 }
 
 GlobalImageList::~GlobalImageList()
 {
+    osl::MutexGuard guard( getGlobalImageListMutex() );
+    // remove global pointer as we destroy the object now
+    pGlobalImageList = 0;
 }
 
 Image GlobalImageList::getImageFromCommandURL( sal_Int16 nImageType, const OUString& rCommandURL )
@@ -343,28 +345,6 @@ bool GlobalImageList::hasImage( sal_Int16 nImageType, const OUString& rCommandUR
     return impl_getImageCommandNameVector();
 }
 
-oslInterlockedCount GlobalImageList::acquire()
-{
-    osl_atomic_increment( &m_nRefCount );
-    return m_nRefCount;
-}
-
-oslInterlockedCount GlobalImageList::release()
-{
-    osl::MutexGuard guard( getGlobalImageListMutex() );
-
-    if ( !osl_atomic_decrement( &m_nRefCount ))
-    {
-        oslInterlockedCount nCount( m_nRefCount );
-        // remove global pointer as we destroy the object now
-        pGlobalImageList = 0;
-        delete this;
-        return nCount;
-    }
-
-    return m_nRefCount;
-}
-
 static bool implts_checkAndScaleGraphic( uno::Reference< XGraphic >& rOutGraphic, const uno::Reference< XGraphic >& rInGraphic, sal_Int16 nImageType )
 {
     static Size   aNormSize( IMAGE_SIZE_NORMAL, IMAGE_SIZE_NORMAL );
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.hxx b/framework/source/uiconfiguration/imagemanagerimpl.hxx
index 362cfe1..93ee508 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.hxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.hxx
@@ -51,6 +51,7 @@
 
 #include <vcl/image.hxx>
 #include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
 
 namespace framework
 {
@@ -83,7 +84,7 @@ namespace framework
             OUString                                                                    m_sIconTheme;
     };
 
-    class GlobalImageList : public CmdImageList, public rtl::IReference
+    class GlobalImageList : public CmdImageList, public salhelper::SimpleReferenceObject
     {
         public:
             GlobalImageList( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
@@ -93,13 +94,6 @@ namespace framework
             virtual bool                            hasImage( sal_Int16 nImageType, const OUString& rCommandURL ) SAL_OVERRIDE;
             virtual ::std::vector< OUString >& getImageNames() SAL_OVERRIDE;
             virtual ::std::vector< OUString >& getImageCommandNames() SAL_OVERRIDE;
-
-            // IReference
-            virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-            virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
-
-        private:
-            oslInterlockedCount                                                              m_nRefCount;
     };
 
     class ImageManagerImpl
commit 0a70789991152ca56007f56aaf44e85d14cc2dcf
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jul 11 15:43:06 2014 +0200

    complete shot-in-the-dark to fix tinderbox build
    
    tinderbox 50 is failing, trying to fix it
    
    Change-Id: I81e3cbdb224110af3036f5726228fd88aba32748

diff --git a/sal/osl/unx/mutex.c b/sal/osl/unx/mutex.c
index 66a51509..a43f662 100644
--- a/sal/osl/unx/mutex.c
+++ b/sal/osl/unx/mutex.c
@@ -25,7 +25,7 @@
 #include <pthread.h>
 #include <stdlib.h>
 
-#if defined LINUX && !((__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 0)) /* bad hack */
+#if defined LINUX && (__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 1) /* bad hack */
 int pthread_mutexattr_setkind_np(pthread_mutexattr_t *, int);
 #define pthread_mutexattr_settype pthread_mutexattr_setkind_np
 #define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP


More information about the Libreoffice-commits mailing list