summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-07-11 15:44:00 +0200
committerNoel Grandin <noel@peralex.com>2014-07-11 15:44:21 +0200
commit1fc3126439ca57a0c1c4897770e77281c5f325c3 (patch)
tree8a054847f670eac710f62c1ed8857dacea72fcff
parent0a70789991152ca56007f56aaf44e85d14cc2dcf (diff)
convert GlobalImageList to SimpleReferenceObject
instead of hand-rolling it's own reference counting Change-Id: Ie90cdce49b9dab68f1bdf487b0f308e03464f893
-rw-r--r--framework/Library_fwk.mk1
-rw-r--r--framework/source/uiconfiguration/imagemanagerimpl.cxx28
-rw-r--r--framework/source/uiconfiguration/imagemanagerimpl.hxx10
3 files changed, 7 insertions, 32 deletions
diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk
index abfc7a91dda7..74e72a9cf136 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 2e974e8c70b5..1c556530d519 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 362cfe1d7c9f..93ee508480b4 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