summaryrefslogtreecommitdiff
path: root/svtools/source/uno/unoimap.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-24 11:02:42 +0200
committerNoel Grandin <noel@peralex.com>2016-05-24 11:02:42 +0200
commit95d20a3799998b9816bd2e8aebdbc96c61cead3e (patch)
tree8206ecc848631432cb8b027d5e780483734f808a /svtools/source/uno/unoimap.cxx
parent3caf31b05d7bbf3d50a1bbda6c8b95982cb5c2b5 (diff)
Revert "remove some manual ref-counting"
until I have a better understanding of the UNO reference counting. This reverts commit 111de438ea3e512a541281dc0716cc728ea8d152.
Diffstat (limited to 'svtools/source/uno/unoimap.cxx')
-rw-r--r--svtools/source/uno/unoimap.cxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx
index e5805c5dafc9..8dee26a8741b 100644
--- a/svtools/source/uno/unoimap.cxx
+++ b/svtools/source/uno/unoimap.cxx
@@ -79,7 +79,7 @@ public:
IMapObject* createIMapObject() const;
- css::uno::Reference<SvMacroTableEventDescriptor> mxEvents;
+ SvMacroTableEventDescriptor* mpEvents;
// overriden helpers from PropertySetHelper
virtual void _setPropertyValues( const PropertyMapEntry** ppEntries, const Any* pValues ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) override;
@@ -186,7 +186,8 @@ SvUnoImageMapObject::SvUnoImageMapObject( sal_uInt16 nType, const SvEventDescrip
, mbIsActive( true )
, mnRadius( 0 )
{
- mxEvents = new SvMacroTableEventDescriptor( pSupportedMacroItems );
+ mpEvents = new SvMacroTableEventDescriptor( pSupportedMacroItems );
+ mpEvents->acquire();
}
SvUnoImageMapObject::SvUnoImageMapObject( const IMapObject& rMapObject, const SvEventDescription* pSupportedMacroItems )
@@ -242,11 +243,13 @@ SvUnoImageMapObject::SvUnoImageMapObject( const IMapObject& rMapObject, const Sv
}
}
- mxEvents = new SvMacroTableEventDescriptor( rMapObject.GetMacroTable(), pSupportedMacroItems );
+ mpEvents = new SvMacroTableEventDescriptor( rMapObject.GetMacroTable(), pSupportedMacroItems );
+ mpEvents->acquire();
}
SvUnoImageMapObject::~SvUnoImageMapObject() throw()
{
+ mpEvents->release();
}
IMapObject* SvUnoImageMapObject::createIMapObject() const
@@ -294,7 +297,7 @@ IMapObject* SvUnoImageMapObject::createIMapObject() const
}
SvxMacroTableDtor aMacroTable;
- mxEvents->copyMacrosIntoTable(aMacroTable);
+ mpEvents->copyMacrosIntoTable(aMacroTable);
pNewIMapObject->SetMacroTable( aMacroTable );
return pNewIMapObject;
@@ -509,7 +512,9 @@ void SvUnoImageMapObject::_getPropertyValues( const PropertyMapEntry** ppEntries
Reference< XNameReplace > SAL_CALL SvUnoImageMapObject::getEvents()
throw( RuntimeException, std::exception )
{
- return mxEvents;
+ // try weak reference first
+ Reference< XNameReplace > xEvents( mpEvents );
+ return xEvents;
}