summaryrefslogtreecommitdiff
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
parent3caf31b05d7bbf3d50a1bbda6c8b95982cb5c2b5 (diff)
Revert "remove some manual ref-counting"
until I have a better understanding of the UNO reference counting. This reverts commit 111de438ea3e512a541281dc0716cc728ea8d152.
-rw-r--r--comphelper/source/misc/accessiblewrapper.cxx22
-rw-r--r--connectivity/source/drivers/dbase/DIndexIter.cxx19
-rw-r--r--connectivity/source/drivers/mork/MConnection.cxx7
-rw-r--r--connectivity/source/drivers/mork/MConnection.hxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.cxx10
-rw-r--r--connectivity/source/inc/dbase/DIndexIter.hxx5
-rw-r--r--editeng/source/xml/editsource.hxx2
-rw-r--r--editeng/source/xml/xmltxtexp.cxx34
-rw-r--r--extensions/source/bibliography/framectr.cxx22
-rw-r--r--extensions/source/bibliography/framectr.hxx2
-rw-r--r--framework/Library_fwi.mk1
-rw-r--r--framework/source/fwe/dispatch/interaction.cxx10
-rw-r--r--include/comphelper/accessiblewrapper.hxx3
-rw-r--r--include/framework/interaction.hxx2
-rw-r--r--include/sfx2/brokenpackageint.hxx4
-rw-r--r--include/ucbhelper/proxydecider.hxx2
-rw-r--r--reportdesign/inc/RptModel.hxx4
-rw-r--r--reportdesign/source/core/sdr/RptModel.cxx10
-rw-r--r--sc/inc/datauno.hxx6
-rw-r--r--sc/inc/dptabsrc.hxx6
-rw-r--r--sc/source/core/data/dptabsrc.cxx35
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx16
-rw-r--r--sc/source/ui/inc/drtxtob.hxx2
-rw-r--r--sc/source/ui/inc/editsh.hxx2
-rw-r--r--sc/source/ui/unoobj/datauno.cxx46
-rw-r--r--sc/source/ui/view/editsh.cxx16
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx2
-rw-r--r--sd/source/ui/inc/OutlineViewShell.hxx2
-rw-r--r--sd/source/ui/view/drviews7.cxx7
-rw-r--r--sd/source/ui/view/drviewsa.cxx10
-rw-r--r--sd/source/ui/view/outlnvsh.cxx15
-rw-r--r--sfx2/source/appl/appuno.cxx14
-rw-r--r--stoc/source/defaultregistry/defaultregistry.cxx158
-rw-r--r--svtools/source/inc/unoiface.hxx2
-rw-r--r--svtools/source/uno/unoiface.cxx17
-rw-r--r--svtools/source/uno/unoimap.cxx15
-rw-r--r--svx/source/fmcomp/gridctrl.cxx13
-rw-r--r--ucbhelper/source/client/proxydecider.cxx12
-rw-r--r--xmloff/source/draw/animationexport.cxx14
-rw-r--r--xmlscript/source/xmlflat_imexp/xmlbas_import.cxx44
-rw-r--r--xmlscript/source/xmlflat_imexp/xmlbas_import.hxx4
-rw-r--r--xmlscript/source/xmllib_imexp/imp_share.hxx4
-rw-r--r--xmlscript/source/xmllib_imexp/xmllib_import.cxx51
-rw-r--r--xmlscript/source/xmlmod_imexp/imp_share.hxx4
-rw-r--r--xmlscript/source/xmlmod_imexp/xmlmod_import.cxx23
45 files changed, 428 insertions, 275 deletions
diff --git a/comphelper/source/misc/accessiblewrapper.cxx b/comphelper/source/misc/accessiblewrapper.cxx
index 41fb4f540fed..e106b9dd14e1 100644
--- a/comphelper/source/misc/accessiblewrapper.cxx
+++ b/comphelper/source/misc/accessiblewrapper.cxx
@@ -347,15 +347,18 @@ namespace comphelper
,m_xInnerContext( _rxInnerAccessibleContext )
,m_xOwningAccessible( _rxOwningAccessible )
,m_xParentAccessible( _rxParentAccessible )
- // initialize the mapper for our children
- ,m_xChildMapper( new OWrappedAccessibleChildrenManager( getComponentContext() ) )
+ ,m_pChildMapper( nullptr )
{
+ // initialize the mapper for our children
+ m_pChildMapper = new OWrappedAccessibleChildrenManager( getComponentContext() );
+ m_pChildMapper->acquire();
+
// determine if we're allowed to cache children
Reference< XAccessibleStateSet > xStates( m_xInnerContext->getAccessibleStateSet( ) );
OSL_ENSURE( xStates.is(), "OAccessibleContextWrapperHelper::OAccessibleContextWrapperHelper: no inner state set!" );
- m_xChildMapper->setTransientChildren( !xStates.is() || xStates->contains( AccessibleStateType::MANAGES_DESCENDANTS) );
+ m_pChildMapper->setTransientChildren( !xStates.is() || xStates->contains( AccessibleStateType::MANAGES_DESCENDANTS) );
- m_xChildMapper->setOwningAccessible( m_xOwningAccessible );
+ m_pChildMapper->setOwningAccessible( m_xOwningAccessible );
}
@@ -380,6 +383,9 @@ namespace comphelper
OAccessibleContextWrapperHelper::~OAccessibleContextWrapperHelper( )
{
OSL_ENSURE( m_rBHelper.bDisposed, "OAccessibleContextWrapperHelper::~OAccessibleContextWrapperHelper: you should ensure (in your dtor) that the object is disposed!" );
+
+ m_pChildMapper->release();
+ m_pChildMapper = nullptr;
}
@@ -405,7 +411,7 @@ namespace comphelper
{
// get the child of the wrapped component
Reference< XAccessible > xInnerChild = m_xInnerContext->getAccessibleChild( i );
- return m_xChildMapper->getAccessibleWrapperFor( xInnerChild );
+ return m_pChildMapper->getAccessibleWrapperFor( xInnerChild );
}
@@ -440,10 +446,10 @@ namespace comphelper
// translate the event
queryInterface( cppu::UnoType<XInterface>::get() ) >>= aTranslatedEvent.Source;
- m_xChildMapper->translateAccessibleEvent( _rEvent, aTranslatedEvent );
+ m_pChildMapper->translateAccessibleEvent( _rEvent, aTranslatedEvent );
// see if any of these notifications affect our child manager
- m_xChildMapper->handleChildNotification( _rEvent );
+ m_pChildMapper->handleChildNotification( _rEvent );
if ( aTranslatedEvent.NewValue == m_xInner )
aTranslatedEvent.NewValue = makeAny(aTranslatedEvent.Source);
@@ -466,7 +472,7 @@ namespace comphelper
xBroadcaster->removeAccessibleEventListener( this );
// dispose the child cache/map
- m_xChildMapper->dispose();
+ m_pChildMapper->dispose();
// let the base class dispose the inner component
OComponentProxyAggregationHelper::dispose();
diff --git a/connectivity/source/drivers/dbase/DIndexIter.cxx b/connectivity/source/drivers/dbase/DIndexIter.cxx
index 3f072f8172d1..3c0318b4c36f 100644
--- a/connectivity/source/drivers/dbase/DIndexIter.cxx
+++ b/connectivity/source/drivers/dbase/DIndexIter.cxx
@@ -30,6 +30,7 @@ using namespace connectivity::file;
OIndexIterator::~OIndexIterator()
{
+ m_pIndex->release();
}
@@ -50,7 +51,7 @@ sal_uInt32 OIndexIterator::Find(bool bFirst)
if (bFirst)
{
- m_aRoot = m_xIndex->getRoot();
+ m_aRoot = m_pIndex->getRoot();
m_aCurLeaf.Clear();
}
@@ -61,7 +62,7 @@ sal_uInt32 OIndexIterator::Find(bool bFirst)
{
ONDXPage* pPage = m_aRoot;
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_xIndex.get());
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = NODE_NOTFOUND;
@@ -107,8 +108,8 @@ ONDXKey* OIndexIterator::GetFirstKey(ONDXPage* pPage, const OOperand& rKey)
if (!pPage->IsLeaf())
{
// descend further
- ONDXPagePtr aPage = (i==0) ? pPage->GetChild(m_xIndex.get())
- : ((*pPage)[i-1]).GetChild(m_xIndex.get(), pPage);
+ ONDXPagePtr aPage = (i==0) ? pPage->GetChild(m_pIndex)
+ : ((*pPage)[i-1]).GetChild(m_pIndex, pPage);
pFoundKey = aPage.Is() ? GetFirstKey(aPage, rKey) : nullptr;
}
else if (i == pPage->Count())
@@ -143,7 +144,7 @@ sal_uInt32 OIndexIterator::GetCompare(bool bFirst)
case SQLFilterOperator::LESS:
case SQLFilterOperator::LESS_EQUAL:
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_xIndex.get());
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = NODE_NOTFOUND;
@@ -205,7 +206,7 @@ sal_uInt32 OIndexIterator::GetLike(bool bFirst)
ONDXPage* pPage = m_aRoot;
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_xIndex.get());
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = NODE_NOTFOUND;
@@ -224,7 +225,7 @@ sal_uInt32 OIndexIterator::GetNull(bool bFirst)
{
ONDXPage* pPage = m_aRoot;
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_xIndex.get());
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = NODE_NOTFOUND;
@@ -273,7 +274,7 @@ ONDXKey* OIndexIterator::GetNextKey()
sal_uInt16 nPos = pParentPage->Search(pPage);
if (nPos != pParentPage->Count() - 1)
{ // page found
- pPage = (*pParentPage)[nPos+1].GetChild(m_xIndex.get(),pParentPage);
+ pPage = (*pParentPage)[nPos+1].GetChild(m_pIndex,pParentPage);
break;
}
}
@@ -282,7 +283,7 @@ ONDXKey* OIndexIterator::GetNextKey()
// now go on with leaf
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_xIndex.get());
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = 0;
diff --git a/connectivity/source/drivers/mork/MConnection.cxx b/connectivity/source/drivers/mork/MConnection.cxx
index 84722b594564..633f84e3011f 100644
--- a/connectivity/source/drivers/mork/MConnection.cxx
+++ b/connectivity/source/drivers/mork/MConnection.cxx
@@ -40,9 +40,10 @@ static const int defaultScope = 0x80;
OConnection::OConnection(MorkDriver* _pDriver)
:OSubComponent<OConnection, OConnection_BASE>(static_cast<cppu::OWeakObject*>(_pDriver), this)
- ,m_xDriver(_pDriver)
+ ,m_pDriver(_pDriver)
,m_aColumnAlias( _pDriver->getFactory() )
{
+ m_pDriver->acquire();
m_pBook = new MorkParser();
m_pHistory = new MorkParser();
}
@@ -51,6 +52,8 @@ OConnection::~OConnection()
{
if(!isClosed())
close();
+ m_pDriver->release();
+ m_pDriver = nullptr;
delete m_pBook;
delete m_pHistory;
}
@@ -109,7 +112,7 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
// production?
if (unittestIndex == -1)
{
- OUString path = m_xDriver->getProfilePath();
+ OUString path = m_pDriver->getProfilePath();
SAL_INFO("connectivity.mork", "ProfilePath: " << path);
abook = path + "/abook.mab";
history = path + "/history.mab";
diff --git a/connectivity/source/drivers/mork/MConnection.hxx b/connectivity/source/drivers/mork/MConnection.hxx
index e573d057aafd..3654b6926085 100644
--- a/connectivity/source/drivers/mork/MConnection.hxx
+++ b/connectivity/source/drivers/mork/MConnection.hxx
@@ -37,7 +37,7 @@ namespace connectivity
// Data attributes
- css::uno::Reference<MorkDriver> m_xDriver; // Pointer to the owning
+ MorkDriver* m_pDriver; // Pointer to the owning
// driver object
OColumnAlias m_aColumnAlias;
// Mork Parser (abook)
@@ -52,7 +52,7 @@ namespace connectivity
explicit OConnection(MorkDriver* const driver);
virtual ~OConnection();
- const css::uno::Reference<MorkDriver>& getDriver() {return m_xDriver;};
+ MorkDriver* getDriver() {return m_pDriver;};
MorkParser* getMorkParser(const OString& t) {return t == "CollectedAddressBook" ? m_pHistory : m_pBook;};
// OComponentHelper
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index 214f08c47b7d..ebe1aaac52f2 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -96,24 +96,28 @@ namespace pq_sdbc_driver
// Helper class for statement lifetime management
class ClosableReference : public cppu::WeakImplHelper< com::sun::star::uno::XReference >
{
- css::uno::Reference<Connection> m_conn;
+ Connection *m_conn;
::rtl::ByteSequence m_id;
public:
ClosableReference( const ::rtl::ByteSequence & id , Connection *that )
: m_conn( that ), m_id( id )
{
+ that->acquire();
}
virtual ~ClosableReference()
{
+ if( m_conn )
+ m_conn->release();
}
virtual void SAL_CALL dispose() throw (std::exception) override
{
- if( m_conn.is() )
+ if( m_conn )
{
m_conn->removeFromWeakMap(m_id);
- m_conn.clear();
+ m_conn->release();
+ m_conn = nullptr;
}
}
};
diff --git a/connectivity/source/inc/dbase/DIndexIter.hxx b/connectivity/source/inc/dbase/DIndexIter.hxx
index 7b950fdd0923..0b70f96e0c25 100644
--- a/connectivity/source/inc/dbase/DIndexIter.hxx
+++ b/connectivity/source/inc/dbase/DIndexIter.hxx
@@ -36,7 +36,7 @@ namespace connectivity
protected:
file::OBoolOperator* m_pOperator;
const file::OOperand* m_pOperand;
- css::uno::Reference<ODbaseIndex> m_xIndex;
+ ODbaseIndex* m_pIndex;
ONDXPagePtr m_aRoot,
m_aCurLeaf;
sal_uInt16 m_nCurNode;
@@ -57,9 +57,10 @@ namespace connectivity
const file::OOperand* pOper)
:m_pOperator(pOp)
,m_pOperand(pOper)
- ,m_xIndex(pInd)
+ ,m_pIndex(pInd)
,m_nCurNode(NODE_NOTFOUND)
{
+ pInd->acquire();
}
virtual ~OIndexIterator();
diff --git a/editeng/source/xml/editsource.hxx b/editeng/source/xml/editsource.hxx
index a22728f34e4b..4b49838448ad 100644
--- a/editeng/source/xml/editsource.hxx
+++ b/editeng/source/xml/editsource.hxx
@@ -38,7 +38,7 @@ public:
private:
explicit SvxEditEngineSource( SvxEditEngineSourceImpl* pImpl );
- rtl::Reference<SvxEditEngineSourceImpl> mxImpl;
+ SvxEditEngineSourceImpl* mpImpl;
};
#endif
diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx
index 6535b6505603..28e4f497ed8e 100644
--- a/editeng/source/xml/xmltxtexp.cxx
+++ b/editeng/source/xml/xmltxtexp.cxx
@@ -59,22 +59,28 @@ using namespace cppu;
class SvxEditEngineSourceImpl;
-class SvxEditEngineSourceImpl : public salhelper::SimpleReferenceObject
+class SvxEditEngineSourceImpl
{
private:
+ oslInterlockedCount maRefCount;
+
EditEngine* mpEditEngine;
SvxTextForwarder* mpTextForwarder;
- virtual ~SvxEditEngineSourceImpl();
+ ~SvxEditEngineSourceImpl();
public:
explicit SvxEditEngineSourceImpl( EditEngine* pEditEngine );
+ void SAL_CALL acquire();
+ void SAL_CALL release();
+
SvxTextForwarder* GetTextForwarder();
};
SvxEditEngineSourceImpl::SvxEditEngineSourceImpl( EditEngine* pEditEngine )
-: mpEditEngine( pEditEngine ),
+: maRefCount(0),
+ mpEditEngine( pEditEngine ),
mpTextForwarder(nullptr)
{
}
@@ -84,6 +90,17 @@ SvxEditEngineSourceImpl::~SvxEditEngineSourceImpl()
delete mpTextForwarder;
}
+void SAL_CALL SvxEditEngineSourceImpl::acquire()
+{
+ osl_atomic_increment( &maRefCount );
+}
+
+void SAL_CALL SvxEditEngineSourceImpl::release()
+{
+ if( ! osl_atomic_decrement( &maRefCount ) )
+ delete this;
+}
+
SvxTextForwarder* SvxEditEngineSourceImpl::GetTextForwarder()
{
if (!mpTextForwarder)
@@ -94,27 +111,30 @@ SvxTextForwarder* SvxEditEngineSourceImpl::GetTextForwarder()
// SvxTextEditSource
SvxEditEngineSource::SvxEditEngineSource( EditEngine* pEditEngine )
- : mxImpl( new SvxEditEngineSourceImpl( pEditEngine ) )
{
+ mpImpl = new SvxEditEngineSourceImpl( pEditEngine );
+ mpImpl->acquire();
}
SvxEditEngineSource::SvxEditEngineSource( SvxEditEngineSourceImpl* pImpl )
- : mxImpl(pImpl)
{
+ mpImpl = pImpl;
+ mpImpl->acquire();
}
SvxEditEngineSource::~SvxEditEngineSource()
{
+ mpImpl->release();
}
SvxEditSource* SvxEditEngineSource::Clone() const
{
- return new SvxEditEngineSource( mxImpl.get() );
+ return new SvxEditEngineSource( mpImpl );
}
SvxTextForwarder* SvxEditEngineSource::GetTextForwarder()
{
- return mxImpl->GetTextForwarder();
+ return mpImpl->GetTextForwarder();
}
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx
index 0e06fed4b1b1..ad713bd538cb 100644
--- a/extensions/source/bibliography/framectr.cxx
+++ b/extensions/source/bibliography/framectr.cxx
@@ -178,13 +178,15 @@ BibFrameController_Impl::BibFrameController_Impl( const uno::Reference< awt::XWi
pParent->SetUniqueId(UID_BIB_FRAME_WINDOW);
bDisposing=false;
bHierarchical=true;
- mxImpl = new BibFrameCtrl_Impl;
- mxImpl->pController = this;
+ pImp = new BibFrameCtrl_Impl;
+ pImp->pController = this;
+ pImp->acquire();
}
BibFrameController_Impl::~BibFrameController_Impl()
{
- mxImpl->pController = nullptr;
+ pImp->pController = nullptr;
+ pImp->release();
delete pDatMan;
if(pBibMod)
CloseBibModul(pBibMod);
@@ -211,7 +213,7 @@ css::uno::Sequence< OUString > SAL_CALL BibFrameController_Impl::getSupportedSer
void BibFrameController_Impl::attachFrame( const uno::Reference< XFrame > & xArg ) throw (css::uno::RuntimeException, std::exception)
{
xFrame = xArg;
- xFrame->addFrameActionListener( mxImpl );
+ xFrame->addFrameActionListener( pImp );
}
sal_Bool BibFrameController_Impl::attachModel( const uno::Reference< XModel > & /*xModel*/ ) throw (css::uno::RuntimeException, std::exception)
@@ -222,9 +224,9 @@ sal_Bool BibFrameController_Impl::attachModel( const uno::Reference< XModel > &
sal_Bool BibFrameController_Impl::suspend( sal_Bool bSuspend ) throw (css::uno::RuntimeException, std::exception)
{
if ( bSuspend )
- getFrame()->removeFrameActionListener( mxImpl );
+ getFrame()->removeFrameActionListener( pImp );
else
- getFrame()->addFrameActionListener( mxImpl );
+ getFrame()->addFrameActionListener( pImp );
return true;
}
@@ -252,7 +254,7 @@ void BibFrameController_Impl::dispose() throw (css::uno::RuntimeException, std::
bDisposing = true;
lang::EventObject aObject;
aObject.Source = static_cast<XController*>(this);
- mxImpl->aLC.disposeAndClear(aObject);
+ pImp->aLC.disposeAndClear(aObject);
m_xDatMan = nullptr;
pDatMan = nullptr;
aStatusListeners.clear();
@@ -260,12 +262,12 @@ void BibFrameController_Impl::dispose() throw (css::uno::RuntimeException, std::
void BibFrameController_Impl::addEventListener( const uno::Reference< lang::XEventListener > & aListener ) throw (css::uno::RuntimeException, std::exception)
{
- mxImpl->aLC.addInterface( cppu::UnoType<lang::XEventListener>::get(), aListener );
+ pImp->aLC.addInterface( cppu::UnoType<lang::XEventListener>::get(), aListener );
}
void BibFrameController_Impl::removeEventListener( const uno::Reference< lang::XEventListener > & aListener ) throw (css::uno::RuntimeException, std::exception)
{
- mxImpl->aLC.removeInterface( cppu::UnoType<lang::XEventListener>::get(), aListener );
+ pImp->aLC.removeInterface( cppu::UnoType<lang::XEventListener>::get(), aListener );
}
uno::Reference< frame::XDispatch > BibFrameController_Impl::queryDispatch( const util::URL& aURL, const OUString& /*aTarget*/, sal_Int32 /*nSearchFlags*/ ) throw (css::uno::RuntimeException, std::exception)
@@ -556,7 +558,7 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen
bLeft = xCursor->isLast() && nCount > 1;
bRight= !xCursor->isLast();
// ask for confirmation
- Reference< frame::XController > xCtrl = mxImpl->pController;
+ Reference< frame::XController > xCtrl = pImp->pController;
Reference< form::XConfirmDeleteListener > xConfirm(pDatMan->GetFormController(),UNO_QUERY);
if (xConfirm.is())
{
diff --git a/extensions/source/bibliography/framectr.hxx b/extensions/source/bibliography/framectr.hxx
index bcc574e3208b..feb94c37c383 100644
--- a/extensions/source/bibliography/framectr.hxx
+++ b/extensions/source/bibliography/framectr.hxx
@@ -60,7 +60,7 @@ class BibFrameController_Impl : public cppu::WeakImplHelper <
>
{
friend class BibFrameCtrl_Impl;
- css::uno::Reference<BibFrameCtrl_Impl> mxImpl;
+ BibFrameCtrl_Impl* pImp;
BibStatusDispatchArr aStatusListeners;
css::uno::Reference< css::awt::XWindow > xWindow;
css::uno::Reference< css::frame::XFrame > xFrame;
diff --git a/framework/Library_fwi.mk b/framework/Library_fwi.mk
index 8435b9df474e..5e829635723d 100644
--- a/framework/Library_fwi.mk
+++ b/framework/Library_fwi.mk
@@ -41,7 +41,6 @@ $(eval $(call gb_Library_use_libraries,fwi,\
cppuhelper \
i18nlangtag \
sal \
- salhelper \
svl \
svt \
tk \
diff --git a/framework/source/fwe/dispatch/interaction.cxx b/framework/source/fwe/dispatch/interaction.cxx
index 0229db2fddf1..6fc5c69086f2 100644
--- a/framework/source/fwe/dispatch/interaction.cxx
+++ b/framework/source/fwe/dispatch/interaction.cxx
@@ -156,12 +156,14 @@ css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > >
}
RequestFilterSelect::RequestFilterSelect( const OUString& sURL )
- : mxImpl(new RequestFilterSelect_Impl( sURL ))
{
+ pImp = new RequestFilterSelect_Impl( sURL );
+ pImp->acquire();
}
RequestFilterSelect::~RequestFilterSelect()
{
+ pImp->release();
}
// return abort state of interaction
@@ -169,7 +171,7 @@ RequestFilterSelect::~RequestFilterSelect()
bool RequestFilterSelect::isAbort() const
{
- return mxImpl->isAbort();
+ return pImp->isAbort();
}
// return user selected filter
@@ -177,12 +179,12 @@ bool RequestFilterSelect::isAbort() const
OUString RequestFilterSelect::getFilter() const
{
- return mxImpl->getFilter();
+ return pImp->getFilter();
}
uno::Reference < task::XInteractionRequest > RequestFilterSelect::GetRequest()
{
- return mxImpl;
+ return uno::Reference < task::XInteractionRequest > (pImp);
}
class InteractionRequest_Impl : public ::cppu::WeakImplHelper< css::task::XInteractionRequest >
diff --git a/include/comphelper/accessiblewrapper.hxx b/include/comphelper/accessiblewrapper.hxx
index e3aa2feff03b..3b808724f933 100644
--- a/include/comphelper/accessiblewrapper.hxx
+++ b/include/comphelper/accessiblewrapper.hxx
@@ -156,8 +156,7 @@ namespace comphelper
css::uno::Reference< css::accessibility::XAccessible >
m_xParentAccessible;
- css::uno::Reference<OWrappedAccessibleChildrenManager>
- m_xChildMapper; // for mapping children from our inner context to our callers
+ OWrappedAccessibleChildrenManager* m_pChildMapper; // for mapping children from our inner context to our callers
protected:
/** ctor
diff --git a/include/framework/interaction.hxx b/include/framework/interaction.hxx
index ab7889c294ea..a57b3edc0e28 100644
--- a/include/framework/interaction.hxx
+++ b/include/framework/interaction.hxx
@@ -60,7 +60,7 @@ namespace framework{
class RequestFilterSelect_Impl;
class FWE_DLLPUBLIC RequestFilterSelect
{
- css::uno::Reference<RequestFilterSelect_Impl> mxImpl;
+ RequestFilterSelect_Impl* pImp;
public:
RequestFilterSelect( const OUString& sURL );
diff --git a/include/sfx2/brokenpackageint.hxx b/include/sfx2/brokenpackageint.hxx
index ddfe7157dbf2..68cb33022608 100644
--- a/include/sfx2/brokenpackageint.hxx
+++ b/include/sfx2/brokenpackageint.hxx
@@ -29,7 +29,7 @@
class RequestPackageReparation_Impl;
class SFX2_DLLPUBLIC RequestPackageReparation
{
- css::uno::Reference<RequestPackageReparation_Impl> mxImpl;
+ RequestPackageReparation_Impl* pImp;
public:
RequestPackageReparation( const OUString& aName );
~RequestPackageReparation();
@@ -40,7 +40,7 @@ public:
class NotifyBrokenPackage_Impl;
class SFX2_DLLPUBLIC NotifyBrokenPackage
{
- css::uno::Reference<NotifyBrokenPackage_Impl> mxImpl;
+ NotifyBrokenPackage_Impl* pImp;
public:
NotifyBrokenPackage( const OUString& aName );
~NotifyBrokenPackage();
diff --git a/include/ucbhelper/proxydecider.hxx b/include/ucbhelper/proxydecider.hxx
index 4bb62f13c5ff..aa19d483fcc9 100644
--- a/include/ucbhelper/proxydecider.hxx
+++ b/include/ucbhelper/proxydecider.hxx
@@ -127,7 +127,7 @@ public:
sal_Int32 nPort ) const;
private:
- css::uno::Reference<proxydecider_impl::InternetProxyDecider_Impl> m_xImpl;
+ proxydecider_impl::InternetProxyDecider_Impl * m_pImpl;
};
} // namespace ucbhelper
diff --git a/reportdesign/inc/RptModel.hxx b/reportdesign/inc/RptModel.hxx
index 7d16a9308b16..b37ed16fdec3 100644
--- a/reportdesign/inc/RptModel.hxx
+++ b/reportdesign/inc/RptModel.hxx
@@ -43,7 +43,7 @@ class REPORTDESIGN_DLLPUBLIC OReportModel : public SdrModel
friend class OReportPage;
private:
- css::uno::Reference<OXUndoEnvironment> m_xUndoEnv;
+ OXUndoEnvironment* m_pUndoEnv;
::dbaui::DBSubComponentController* m_pController;
::reportdesign::OReportDefinition* m_pReportDefinition;
@@ -63,7 +63,7 @@ public:
/** @returns the numbering type that is used to format page fields in drawing shapes */
virtual SvxNumType GetPageNumType() const override;
- OXUndoEnvironment& GetUndoEnv() { return *m_xUndoEnv.get();}
+ OXUndoEnvironment& GetUndoEnv() { return *m_pUndoEnv;}
void SetModified(bool _bModified);
inline dbaui::DBSubComponentController* getController() const { return m_pController; }
diff --git a/reportdesign/source/core/sdr/RptModel.cxx b/reportdesign/source/core/sdr/RptModel.cxx
index 0358ecf64a77..f4d66d113386 100644
--- a/reportdesign/source/core/sdr/RptModel.cxx
+++ b/reportdesign/source/core/sdr/RptModel.cxx
@@ -50,7 +50,8 @@ OReportModel::OReportModel(::reportdesign::OReportDefinition* _pReportDefinition
,m_pController(nullptr)
,m_pReportDefinition(_pReportDefinition)
{
- m_xUndoEnv = new OXUndoEnvironment(*this);
+ m_pUndoEnv = new OXUndoEnvironment(*this);
+ m_pUndoEnv->acquire();
SetSdrUndoFactory(new OReportUndoFactory);
}
@@ -58,15 +59,16 @@ OReportModel::OReportModel(::reportdesign::OReportDefinition* _pReportDefinition
OReportModel::~OReportModel()
{
detachController();
+ m_pUndoEnv->release();
}
void OReportModel::detachController()
{
m_pReportDefinition = nullptr;
m_pController = nullptr;
- m_xUndoEnv->EndListening( *this );
+ m_pUndoEnv->EndListening( *this );
ClearUndoBuffer();
- m_xUndoEnv->Clear(OXUndoEnvironment::Accessor());
+ m_pUndoEnv->Clear(OXUndoEnvironment::Accessor());
}
SdrPage* OReportModel::AllocPage(bool /*bMasterPage*/)
@@ -100,7 +102,7 @@ OReportPage* OReportModel::createNewPage(const uno::Reference< report::XSection
SolarMutexGuard aSolarGuard;
OReportPage* pPage = new OReportPage( *this ,_xSection);
InsertPage(pPage);
- m_xUndoEnv->AddSection(_xSection);
+ m_pUndoEnv->AddSection(_xSection);
return pPage;
}
diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx
index cb33562bf0b2..cbaebc7514a9 100644
--- a/sc/inc/datauno.hxx
+++ b/sc/inc/datauno.hxx
@@ -222,7 +222,7 @@ public:
class ScRangeSubTotalDescriptor : public ScSubTotalDescriptorBase
{
private:
- css::uno::Reference<ScDatabaseRangeObj> mxParent;
+ ScDatabaseRangeObj* pParent;
public:
ScRangeSubTotalDescriptor(ScDatabaseRangeObj* pPar);
@@ -435,7 +435,7 @@ public:
class ScRangeFilterDescriptor : public ScFilterDescriptorBase
{
private:
- css::uno::Reference<ScDatabaseRangeObj> mxParent;
+ ScDatabaseRangeObj* pParent;
public:
ScRangeFilterDescriptor(ScDocShell* pDocSh, ScDatabaseRangeObj* pPar);
@@ -451,7 +451,7 @@ public:
class ScDataPilotFilterDescriptor : public ScFilterDescriptorBase
{
private:
- css::uno::Reference<ScDataPilotDescriptorBase> mxParent;
+ ScDataPilotDescriptorBase* pParent;
public:
ScDataPilotFilterDescriptor(ScDocShell* pDocSh, ScDataPilotDescriptorBase* pPar);
diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx
index bfc9e2924f3f..035ba282ef9d 100644
--- a/sc/inc/dptabsrc.hxx
+++ b/sc/inc/dptabsrc.hxx
@@ -307,7 +307,7 @@ class ScDPDimension : public cppu::WeakImplHelper<
{
ScDPSource* pSource;
long nDim; // dimension index (== column ID)
- css::uno::Reference<ScDPHierarchies> mxHierarchies;
+ ScDPHierarchies* pHierarchies;
long nUsedHier;
sal_uInt16 nFunction; // enum GeneralFunction
OUString aName; // if empty, take from source
@@ -459,7 +459,7 @@ private:
ScDPSource* pSource;
long nDim;
long nHier;
- css::uno::Reference<ScDPLevels> mxLevels;
+ ScDPLevels* pLevels;
public:
ScDPHierarchy( ScDPSource* pSrc, long nD, long nH );
@@ -539,7 +539,7 @@ private:
long nDim;
long nHier;
long nLev;
- css::uno::Reference<ScDPMembers> mxMembers;
+ ScDPMembers* pMembers;
css::uno::Sequence<css::sheet::GeneralFunction> aSubTotals;
css::sheet::DataPilotFieldSortInfo aSortInfo; // stored user settings
css::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo; // stored user settings
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index ce48a82446cb..c652cf2af303 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -1333,6 +1333,7 @@ ScDPDimension* ScDPDimensions::getByIndex(long nIndex) const
ScDPDimension::ScDPDimension( ScDPSource* pSrc, long nD ) :
pSource( pSrc ),
nDim( nD ),
+ pHierarchies( nullptr ),
nUsedHier( 0 ),
nFunction( SUBTOTAL_FUNC_SUM ), // sum is default
mpLayoutName(nullptr),
@@ -1349,16 +1350,20 @@ ScDPDimension::~ScDPDimension()
{
//TODO: release pSource
+ if ( pHierarchies )
+ pHierarchies->release(); // ref-counted
+
delete pSelectedData;
}
ScDPHierarchies* ScDPDimension::GetHierarchiesObject()
{
- if (!mxHierarchies.is())
+ if (!pHierarchies)
{
- mxHierarchies = new ScDPHierarchies( pSource, nDim );
+ pHierarchies = new ScDPHierarchies( pSource, nDim );
+ pHierarchies->acquire(); // ref-counted
}
- return mxHierarchies.get();
+ return pHierarchies;
}
const OUString* ScDPDimension::GetLayoutName() const
@@ -1785,7 +1790,8 @@ ScDPHierarchy* ScDPHierarchies::getByIndex(long nIndex) const
ScDPHierarchy::ScDPHierarchy( ScDPSource* pSrc, long nD, long nH ) :
pSource( pSrc ),
nDim( nD ),
- nHier( nH )
+ nHier( nH ),
+ pLevels( nullptr )
{
//TODO: hold pSource
}
@@ -1793,15 +1799,19 @@ ScDPHierarchy::ScDPHierarchy( ScDPSource* pSrc, long nD, long nH ) :
ScDPHierarchy::~ScDPHierarchy()
{
//TODO: release pSource
+
+ if (pLevels)
+ pLevels->release(); // ref-counted
}
ScDPLevels* ScDPHierarchy::GetLevelsObject()
{
- if (!mxLevels.is())
+ if (!pLevels)
{
- mxLevels = new ScDPLevels( pSource, nDim, nHier );
+ pLevels = new ScDPLevels( pSource, nDim, nHier );
+ pLevels->acquire(); // ref-counted
}
- return mxLevels.get();
+ return pLevels;
}
uno::Reference<container::XNameAccess> SAL_CALL ScDPHierarchy::getLevels()
@@ -1987,6 +1997,7 @@ ScDPLevel::ScDPLevel( ScDPSource* pSrc, long nD, long nH, long nL ) :
nDim( nD ),
nHier( nH ),
nLev( nL ),
+ pMembers( nullptr ),
aSortInfo( EMPTY_OUSTRING, true, sheet::DataPilotFieldSortMode::NAME ), // default: sort by name
nSortMeasure( 0 ),
nAutoMeasure( 0 ),
@@ -2001,6 +2012,9 @@ ScDPLevel::ScDPLevel( ScDPSource* pSrc, long nD, long nH, long nL ) :
ScDPLevel::~ScDPLevel()
{
//TODO: release pSource
+
+ if ( pMembers )
+ pMembers->release(); // ref-counted
}
void ScDPLevel::EvaluateSortOrder()
@@ -2067,11 +2081,12 @@ void ScDPLevel::SetEnableLayout(bool bSet)
ScDPMembers* ScDPLevel::GetMembersObject()
{
- if (!mxMembers.is())
+ if (!pMembers)
{
- mxMembers = new ScDPMembers( pSource, nDim, nHier, nLev );
+ pMembers = new ScDPMembers( pSource, nDim, nHier, nLev );
+ pMembers->acquire(); // ref-counted
}
- return mxMembers.get();
+ return pMembers;
}
uno::Reference<container::XNameAccess> SAL_CALL ScDPLevel::getMembers() throw(uno::RuntimeException, std::exception)
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 2709e613240b..ee4d1ec01480 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -113,6 +113,7 @@ void ScDrawTextObjectBar::StateDisableItems( SfxItemSet &rSet )
ScDrawTextObjectBar::ScDrawTextObjectBar(ScViewData* pData) :
SfxShell(pData->GetViewShell()),
pViewData(pData),
+ pClipEvtLstnr(nullptr),
bPastePossible(false)
{
SetPool( pViewData->GetScDrawView()->GetDefaultAttr().GetPool() );
@@ -132,13 +133,15 @@ ScDrawTextObjectBar::ScDrawTextObjectBar(ScViewData* pData) :
ScDrawTextObjectBar::~ScDrawTextObjectBar()
{
- if ( mxClipEvtLstnr.is() )
+ if ( pClipEvtLstnr )
{
- mxClipEvtLstnr->AddRemoveListener( pViewData->GetActiveWin(), false );
+ pClipEvtLstnr->AddRemoveListener( pViewData->GetActiveWin(), false );
// The listener may just now be waiting for the SolarMutex and call the link
// afterwards, in spite of RemoveListener. So the link has to be reset, too.
- mxClipEvtLstnr->ClearCallbackLink();
+ pClipEvtLstnr->ClearCallbackLink();
+
+ pClipEvtLstnr->release();
}
}
@@ -489,12 +492,13 @@ void ScDrawTextObjectBar::GetClipState( SfxItemSet& rSet )
return;
}
- if ( !mxClipEvtLstnr.is() )
+ if ( !pClipEvtLstnr )
{
// create listener
- mxClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScDrawTextObjectBar, ClipboardChanged ) );
+ pClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScDrawTextObjectBar, ClipboardChanged ) );
+ pClipEvtLstnr->acquire();
vcl::Window* pWin = pViewData->GetActiveWin();
- mxClipEvtLstnr->AddRemoveListener( pWin, true );
+ pClipEvtLstnr->AddRemoveListener( pWin, true );
// get initial state
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
diff --git a/sc/source/ui/inc/drtxtob.hxx b/sc/source/ui/inc/drtxtob.hxx
index 7b40147ddff4..09c1d94d4bfa 100644
--- a/sc/source/ui/inc/drtxtob.hxx
+++ b/sc/source/ui/inc/drtxtob.hxx
@@ -35,7 +35,7 @@ class TransferableClipboardListener;
class ScDrawTextObjectBar : public SfxShell
{
ScViewData* pViewData;
- css::uno::Reference<TransferableClipboardListener> mxClipEvtLstnr;
+ TransferableClipboardListener* pClipEvtLstnr;
bool bPastePossible;
DECL_LINK_TYPED( ClipboardChanged, TransferableDataHelper*, void );
diff --git a/sc/source/ui/inc/editsh.hxx b/sc/source/ui/inc/editsh.hxx
index 77b3e8b24480..85d5fdfc1ccf 100644
--- a/sc/source/ui/inc/editsh.hxx
+++ b/sc/source/ui/inc/editsh.hxx
@@ -39,7 +39,7 @@ class ScEditShell : public SfxShell
private:
EditView* pEditView;
ScViewData* pViewData;
- css::uno::Reference<TransferableClipboardListener> mxClipEvtLstnr;
+ TransferableClipboardListener* pClipEvtLstnr;
bool bPastePossible;
bool bIsInsertMode;
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 9c03c5c1e7bd..2772aa2cb536 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -806,24 +806,28 @@ void ScSubTotalDescriptor::SetParam( const ScSubTotalParam& rNew )
}
ScRangeSubTotalDescriptor::ScRangeSubTotalDescriptor(ScDatabaseRangeObj* pPar) :
- mxParent(pPar)
+ pParent(pPar)
{
+ if (pParent)
+ pParent->acquire();
}
ScRangeSubTotalDescriptor::~ScRangeSubTotalDescriptor()
{
+ if (pParent)
+ pParent->release();
}
void ScRangeSubTotalDescriptor::GetData( ScSubTotalParam& rParam ) const
{
- if (mxParent.is())
- mxParent->GetSubTotalParam( rParam );
+ if (pParent)
+ pParent->GetSubTotalParam( rParam );
}
void ScRangeSubTotalDescriptor::PutData( const ScSubTotalParam& rParam )
{
- if (mxParent.is())
- mxParent->SetSubTotalParam( rParam );
+ if (pParent)
+ pParent->SetSubTotalParam( rParam );
}
ScConsolidationDescriptor::ScConsolidationDescriptor()
@@ -1540,41 +1544,49 @@ void ScFilterDescriptor::SetParam( const ScQueryParam& rNew )
ScRangeFilterDescriptor::ScRangeFilterDescriptor(ScDocShell* pDocShell, ScDatabaseRangeObj* pPar) :
ScFilterDescriptorBase(pDocShell),
- mxParent(pPar)
+ pParent(pPar)
{
+ if (pParent)
+ pParent->acquire();
}
ScRangeFilterDescriptor::~ScRangeFilterDescriptor()
{
+ if (pParent)
+ pParent->release();
}
void ScRangeFilterDescriptor::GetData( ScQueryParam& rParam ) const
{
- if (mxParent.is())
- mxParent->GetQueryParam( rParam );
+ if (pParent)
+ pParent->GetQueryParam( rParam );
}
void ScRangeFilterDescriptor::PutData( const ScQueryParam& rParam )
{
- if (mxParent.is())
- mxParent->SetQueryParam( rParam );
+ if (pParent)
+ pParent->SetQueryParam( rParam );
}
ScDataPilotFilterDescriptor::ScDataPilotFilterDescriptor(ScDocShell* pDocShell, ScDataPilotDescriptorBase* pPar) :
ScFilterDescriptorBase(pDocShell),
- mxParent(pPar)
+ pParent(pPar)
{
+ if (pParent)
+ pParent->acquire();
}
ScDataPilotFilterDescriptor::~ScDataPilotFilterDescriptor()
{
+ if (pParent)
+ pParent->release();
}
void ScDataPilotFilterDescriptor::GetData( ScQueryParam& rParam ) const
{
- if (mxParent.is())
+ if (pParent)
{
- ScDPObject* pDPObj = mxParent->GetDPObject();
+ ScDPObject* pDPObj = pParent->GetDPObject();
if (pDPObj && pDPObj->IsSheetData())
rParam = pDPObj->GetSheetDesc()->GetQueryParam();
}
@@ -1582,17 +1594,17 @@ void ScDataPilotFilterDescriptor::GetData( ScQueryParam& rParam ) const
void ScDataPilotFilterDescriptor::PutData( const ScQueryParam& rParam )
{
- if (mxParent.is())
+ if (pParent)
{
- ScDPObject* pDPObj = mxParent->GetDPObject();
+ ScDPObject* pDPObj = pParent->GetDPObject();
if (pDPObj)
{
- ScSheetSourceDesc aSheetDesc(&mxParent->GetDocShell()->GetDocument());
+ ScSheetSourceDesc aSheetDesc(&pParent->GetDocShell()->GetDocument());
if (pDPObj->IsSheetData())
aSheetDesc = *pDPObj->GetSheetDesc();
aSheetDesc.SetQueryParam(rParam);
pDPObj->SetSheetDesc(aSheetDesc);
- mxParent->SetDPObject(pDPObj);
+ pParent->SetDPObject(pDPObj);
}
}
}
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 622989308f44..92f211e13d71 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -93,6 +93,7 @@ void ScEditShell::InitInterface_Impl()
ScEditShell::ScEditShell(EditView* pView, ScViewData* pData) :
pEditView (pView),
pViewData (pData),
+ pClipEvtLstnr (nullptr),
bPastePossible (false),
bIsInsertMode (true)
{
@@ -104,13 +105,15 @@ ScEditShell::ScEditShell(EditView* pView, ScViewData* pData) :
ScEditShell::~ScEditShell()
{
- if ( mxClipEvtLstnr.is() )
+ if ( pClipEvtLstnr )
{
- mxClipEvtLstnr->AddRemoveListener( pViewData->GetActiveWin(), false );
+ pClipEvtLstnr->AddRemoveListener( pViewData->GetActiveWin(), false );
// The listener may just now be waiting for the SolarMutex and call the link
// afterwards, in spite of RemoveListener. So the link has to be reset, too.
- mxClipEvtLstnr->ClearCallbackLink();
+ pClipEvtLstnr->ClearCallbackLink();
+
+ pClipEvtLstnr->release();
}
}
@@ -806,12 +809,13 @@ IMPL_LINK_TYPED( ScEditShell, ClipboardChanged, TransferableDataHelper*, pDataHe
void ScEditShell::GetClipState( SfxItemSet& rSet )
{
- if ( !mxClipEvtLstnr.is() )
+ if ( !pClipEvtLstnr )
{
// create listener
- mxClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScEditShell, ClipboardChanged ) );
+ pClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScEditShell, ClipboardChanged ) );
+ pClipEvtLstnr->acquire();
vcl::Window* pWin = pViewData->GetActiveWin();
- mxClipEvtLstnr->AddRemoveListener( pWin, true );
+ pClipEvtLstnr->AddRemoveListener( pWin, true );
// get initial state
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index e5288089da14..b96a0e2bfd6f 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -446,7 +446,7 @@ private:
css::uno::Reference< css::scanner::XScannerManager2 > mxScannerManager;
css::uno::Reference< css::lang::XEventListener > mxScannerListener;
- css::uno::Reference<TransferableClipboardListener> mxClipEvtLstnr;
+ TransferableClipboardListener* mpClipEvtLstnr;
bool mbPastePossible;
virtual void Notify (SfxBroadcaster& rBC, const SfxHint& rHint) override;
diff --git a/sd/source/ui/inc/OutlineViewShell.hxx b/sd/source/ui/inc/OutlineViewShell.hxx
index 01a57a305ac9..b57bc50151fa 100644
--- a/sd/source/ui/inc/OutlineViewShell.hxx
+++ b/sd/source/ui/inc/OutlineViewShell.hxx
@@ -152,7 +152,7 @@ private:
void ShowSlideShow(SfxRequest& rReq);
OutlineView* pOlView;
SdPage* pLastPage; // For efficient processing of the preview
- css::uno::Reference<TransferableClipboardListener> mxClipEvtLstnr;
+ TransferableClipboardListener* pClipEvtLstnr;
bool bPastePossible;
bool mbInitialized;
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index a774b113c429..cd3162ec40e2 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -608,7 +608,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
SfxItemState::DEFAULT == rSet.GetItemState( SID_PASTE_UNFORMATTED ) ||
SfxItemState::DEFAULT == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) )
{
- if ( !mxClipEvtLstnr.is() )
+ if ( !mpClipEvtLstnr )
{
// avoid clipboard initialization for
// read-only presentation views (workaround for NT4.0
@@ -616,8 +616,9 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
if( dynamic_cast< const PresentationViewShell *>( this ) == nullptr )
{
// create listener
- mxClipEvtLstnr = new TransferableClipboardListener( LINK( this, DrawViewShell, ClipboardChanged ) );
- mxClipEvtLstnr->AddRemoveListener( GetActiveWindow(), true );
+ mpClipEvtLstnr = new TransferableClipboardListener( LINK( this, DrawViewShell, ClipboardChanged ) );
+ mpClipEvtLstnr->acquire();
+ mpClipEvtLstnr->AddRemoveListener( GetActiveWindow(), true );
// get initial state
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index afa1c293533f..52cd788cf58a 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -177,11 +177,11 @@ DrawViewShell::~DrawViewShell()
}
}
- if ( mxClipEvtLstnr.is() )
+ if ( mpClipEvtLstnr )
{
- mxClipEvtLstnr->AddRemoveListener( GetActiveWindow(), false );
- mxClipEvtLstnr->ClearCallbackLink(); // prevent callback if another thread is waiting
- mxClipEvtLstnr.clear();
+ mpClipEvtLstnr->AddRemoveListener( GetActiveWindow(), false );
+ mpClipEvtLstnr->ClearCallbackLink(); // prevent callback if another thread is waiting
+ mpClipEvtLstnr->release();
}
delete mpDrawView;
@@ -201,7 +201,7 @@ void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind)
mpActualPage = nullptr;
mbMousePosFreezed = false;
mbReadOnly = GetDocSh()->IsReadOnly();
- mxClipEvtLstnr.clear();
+ mpClipEvtLstnr = nullptr;
mbPastePossible = false;
mbIsLayerModeActive = false;
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 3f35f85cfec8..86f71567221a 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -191,6 +191,7 @@ OutlineViewShell::OutlineViewShell (
: ViewShell(pFrame, pParentWindow, rViewShellBase),
pOlView(nullptr),
pLastPage( nullptr ),
+ pClipEvtLstnr(nullptr),
bPastePossible(false),
mbInitialized(false)
@@ -219,10 +220,11 @@ OutlineViewShell::~OutlineViewShell()
mpFrameView->Disconnect();
- if ( mxClipEvtLstnr.is() )
+ if ( pClipEvtLstnr )
{
- mxClipEvtLstnr->AddRemoveListener( GetActiveWindow(), false );
- mxClipEvtLstnr->ClearCallbackLink(); // prevent callback if another thread is waiting
+ pClipEvtLstnr->AddRemoveListener( GetActiveWindow(), false );
+ pClipEvtLstnr->ClearCallbackLink(); // prevent callback if another thread is waiting
+ pClipEvtLstnr->release();
}
}
@@ -881,11 +883,12 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet )
if( SfxItemState::DEFAULT == rSet.GetItemState( SID_PASTE ) )
{
- if ( !mxClipEvtLstnr.is() )
+ if ( !pClipEvtLstnr )
{
// create listener
- mxClipEvtLstnr = new TransferableClipboardListener( LINK( this, OutlineViewShell, ClipboardChanged ) );
- mxClipEvtLstnr->AddRemoveListener( GetActiveWindow(), true );
+ pClipEvtLstnr = new TransferableClipboardListener( LINK( this, OutlineViewShell, ClipboardChanged ) );
+ pClipEvtLstnr->acquire();
+ pClipEvtLstnr->AddRemoveListener( GetActiveWindow(), true );
// get initial state
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index ead7e256551b..7c3089beaabb 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -1753,22 +1753,24 @@ uno::Sequence< uno::Reference< task::XInteractionContinuation > >
}
RequestPackageReparation::RequestPackageReparation( const OUString& aName )
- : mxImpl(new RequestPackageReparation_Impl( aName ))
{
+ pImp = new RequestPackageReparation_Impl( aName );
+ pImp->acquire();
}
RequestPackageReparation::~RequestPackageReparation()
{
+ pImp->release();
}
bool RequestPackageReparation::isApproved()
{
- return mxImpl->isApproved();
+ return pImp->isApproved();
}
css::uno::Reference < task::XInteractionRequest > RequestPackageReparation::GetRequest()
{
- return mxImpl;
+ return css::uno::Reference < task::XInteractionRequest >(pImp);
}
@@ -1810,17 +1812,19 @@ uno::Sequence< uno::Reference< task::XInteractionContinuation > >
}
NotifyBrokenPackage::NotifyBrokenPackage( const OUString& aName )
- : mxImpl(new NotifyBrokenPackage_Impl( aName ))
{
+ pImp = new NotifyBrokenPackage_Impl( aName );
+ pImp->acquire();
}
NotifyBrokenPackage::~NotifyBrokenPackage()
{
+ pImp->release();
}
css::uno::Reference < task::XInteractionRequest > NotifyBrokenPackage::GetRequest()
{
- return mxImpl;
+ return css::uno::Reference < task::XInteractionRequest >(pImp);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx
index 5241a0e99959..5637d55f439f 100644
--- a/stoc/source/defaultregistry/defaultregistry.cxx
+++ b/stoc/source/defaultregistry/defaultregistry.cxx
@@ -139,7 +139,7 @@ protected:
OUString m_name;
sal_uInt32 m_state;
- css::uno::Reference<NestedRegistryImpl> m_xRegistry;
+ NestedRegistryImpl* m_pRegistry;
Reference<XRegistryKey> m_localKey;
Reference<XRegistryKey> m_defaultKey;
};
@@ -148,8 +148,10 @@ protected:
NestedKeyImpl::NestedKeyImpl( NestedRegistryImpl* pDefaultRegistry,
Reference<XRegistryKey>& localKey,
Reference<XRegistryKey>& defaultKey )
- : m_xRegistry(pDefaultRegistry)
+ : m_pRegistry(pDefaultRegistry)
{
+ m_pRegistry->acquire();
+
m_localKey = localKey;
m_defaultKey = defaultKey;
@@ -162,14 +164,16 @@ NestedKeyImpl::NestedKeyImpl( NestedRegistryImpl* pDefaultRegistry,
m_name = m_defaultKey->getKeyName();
}
- m_state = m_xRegistry->m_state;
+ m_state = m_pRegistry->m_state;
}
NestedKeyImpl::NestedKeyImpl( const OUString& rKeyName,
NestedKeyImpl* pKey)
- : m_xRegistry(pKey->m_xRegistry)
+ : m_pRegistry(pKey->m_pRegistry)
{
+ m_pRegistry->acquire();
+
if (pKey->m_localKey.is() && pKey->m_localKey->isValid())
{
m_localKey = pKey->m_localKey->openKey(rKeyName);
@@ -188,21 +192,23 @@ NestedKeyImpl::NestedKeyImpl( const OUString& rKeyName,
m_name = m_defaultKey->getKeyName();
}
- m_state = m_xRegistry->m_state;
+ m_state = m_pRegistry->m_state;
}
NestedKeyImpl::~NestedKeyImpl()
{
+ if ( m_pRegistry )
+ m_pRegistry->release();
}
void NestedKeyImpl::computeChanges()
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
- if ( m_state != m_xRegistry->m_state )
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
+ if ( m_state != m_pRegistry->m_state )
{
- Reference<XRegistryKey> rootKey(m_xRegistry->m_localReg->getRootKey());
+ Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
Reference<XRegistryKey> tmpKey = rootKey->openKey(m_name);
@@ -211,7 +217,7 @@ void NestedKeyImpl::computeChanges()
m_localKey = rootKey->openKey(m_name);
}
- m_state = m_xRegistry->m_state;
+ m_state = m_pRegistry->m_state;
}
}
@@ -222,7 +228,7 @@ OUString NestedKeyImpl::computeName(const OUString& name)
{
OUString resLocalName, resDefaultName;
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
try
{
if ( m_localKey.is() && m_localKey->isValid() )
@@ -234,10 +240,10 @@ OUString NestedKeyImpl::computeName(const OUString& name)
return m_defaultKey->getResolvedName(name);
}
- if ( !resLocalName.isEmpty() && m_xRegistry->m_defaultReg->isValid() )
+ if ( !resLocalName.isEmpty() && m_pRegistry->m_defaultReg->isValid() )
{
- Reference<XRegistryKey> localRoot(m_xRegistry->m_localReg->getRootKey());
- Reference<XRegistryKey> defaultRoot(m_xRegistry->m_defaultReg->getRootKey());
+ Reference<XRegistryKey> localRoot(m_pRegistry->m_localReg->getRootKey());
+ Reference<XRegistryKey> defaultRoot(m_pRegistry->m_defaultReg->getRootKey());
resDefaultName = defaultRoot->getResolvedName(resLocalName);
@@ -265,7 +271,7 @@ OUString NestedKeyImpl::computeName(const OUString& name)
OUString SAL_CALL NestedKeyImpl::getKeyName() throw(RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
return m_name;
}
@@ -273,7 +279,7 @@ OUString SAL_CALL NestedKeyImpl::getKeyName() throw(RuntimeException, std::excep
sal_Bool SAL_CALL NestedKeyImpl::isReadOnly( )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -285,7 +291,7 @@ sal_Bool SAL_CALL NestedKeyImpl::isReadOnly( )
sal_Bool SAL_CALL NestedKeyImpl::isValid( ) throw(RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
return ((m_localKey.is() && m_localKey->isValid()) ||
(m_defaultKey.is() && m_defaultKey->isValid()) );
}
@@ -294,7 +300,7 @@ sal_Bool SAL_CALL NestedKeyImpl::isValid( ) throw(RuntimeException, std::except
RegistryKeyType SAL_CALL NestedKeyImpl::getKeyType( const OUString& rKeyName )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -313,7 +319,7 @@ RegistryKeyType SAL_CALL NestedKeyImpl::getKeyType( const OUString& rKeyName )
RegistryValueType SAL_CALL NestedKeyImpl::getValueType( )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -332,7 +338,7 @@ RegistryValueType SAL_CALL NestedKeyImpl::getValueType( )
sal_Int32 SAL_CALL NestedKeyImpl::getLongValue( )
throw(InvalidRegistryException, InvalidValueException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -353,7 +359,7 @@ sal_Int32 SAL_CALL NestedKeyImpl::getLongValue( )
void SAL_CALL NestedKeyImpl::setLongValue( sal_Int32 value )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -362,10 +368,10 @@ void SAL_CALL NestedKeyImpl::setLongValue( sal_Int32 value )
}
else if ( m_defaultKey.is() && m_defaultKey->isValid() )
{
- Reference<XRegistryKey> rootKey(m_xRegistry->m_localReg->getRootKey());
+ Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
m_localKey = rootKey->createKey(m_name);
m_localKey->setLongValue(value);
- m_state = m_xRegistry->m_state++;
+ m_state = m_pRegistry->m_state++;
}
else
{
@@ -377,7 +383,7 @@ void SAL_CALL NestedKeyImpl::setLongValue( sal_Int32 value )
Sequence< sal_Int32 > SAL_CALL NestedKeyImpl::getLongListValue( )
throw(InvalidRegistryException, InvalidValueException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -398,7 +404,7 @@ Sequence< sal_Int32 > SAL_CALL NestedKeyImpl::getLongListValue( )
void SAL_CALL NestedKeyImpl::setLongListValue( const Sequence< sal_Int32 >& seqValue )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -407,10 +413,10 @@ void SAL_CALL NestedKeyImpl::setLongListValue( const Sequence< sal_Int32 >& seqV
}
else if ( m_defaultKey.is() && m_defaultKey->isValid() )
{
- Reference<XRegistryKey> rootKey(m_xRegistry->m_localReg->getRootKey());
+ Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
m_localKey = rootKey->createKey(m_name);
m_localKey->setLongListValue(seqValue);
- m_state = m_xRegistry->m_state++;
+ m_state = m_pRegistry->m_state++;
}
else
{
@@ -422,7 +428,7 @@ void SAL_CALL NestedKeyImpl::setLongListValue( const Sequence< sal_Int32 >& seqV
OUString SAL_CALL NestedKeyImpl::getAsciiValue( )
throw(InvalidRegistryException, InvalidValueException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -443,7 +449,7 @@ OUString SAL_CALL NestedKeyImpl::getAsciiValue( )
void SAL_CALL NestedKeyImpl::setAsciiValue( const OUString& value )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -452,10 +458,10 @@ void SAL_CALL NestedKeyImpl::setAsciiValue( const OUString& value )
}
else if ( m_defaultKey.is() && m_defaultKey->isValid() )
{
- Reference<XRegistryKey> rootKey(m_xRegistry->m_localReg->getRootKey());
+ Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
m_localKey = rootKey->createKey(m_name);
m_localKey->setAsciiValue(value);
- m_state = m_xRegistry->m_state++;
+ m_state = m_pRegistry->m_state++;
}
else
{
@@ -467,7 +473,7 @@ void SAL_CALL NestedKeyImpl::setAsciiValue( const OUString& value )
Sequence< OUString > SAL_CALL NestedKeyImpl::getAsciiListValue( )
throw(InvalidRegistryException, InvalidValueException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -488,7 +494,7 @@ Sequence< OUString > SAL_CALL NestedKeyImpl::getAsciiListValue( )
void SAL_CALL NestedKeyImpl::setAsciiListValue( const Sequence< OUString >& seqValue )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -497,10 +503,10 @@ void SAL_CALL NestedKeyImpl::setAsciiListValue( const Sequence< OUString >& seqV
}
else if ( m_defaultKey.is() && m_defaultKey->isValid() )
{
- Reference<XRegistryKey> rootKey(m_xRegistry->m_localReg->getRootKey());
+ Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
m_localKey = rootKey->createKey(m_name);
m_localKey->setAsciiListValue(seqValue);
- m_state = m_xRegistry->m_state++;
+ m_state = m_pRegistry->m_state++;
}
else
{
@@ -512,7 +518,7 @@ void SAL_CALL NestedKeyImpl::setAsciiListValue( const Sequence< OUString >& seqV
OUString SAL_CALL NestedKeyImpl::getStringValue( )
throw(InvalidRegistryException, InvalidValueException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -533,7 +539,7 @@ OUString SAL_CALL NestedKeyImpl::getStringValue( )
void SAL_CALL NestedKeyImpl::setStringValue( const OUString& value )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -542,10 +548,10 @@ void SAL_CALL NestedKeyImpl::setStringValue( const OUString& value )
}
else if ( m_defaultKey.is() && m_defaultKey->isValid() )
{
- Reference<XRegistryKey> rootKey(m_xRegistry->m_localReg->getRootKey());
+ Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
m_localKey = rootKey->createKey(m_name);
m_localKey->setStringValue(value);
- m_state = m_xRegistry->m_state++;
+ m_state = m_pRegistry->m_state++;
}
else
{
@@ -557,7 +563,7 @@ void SAL_CALL NestedKeyImpl::setStringValue( const OUString& value )
Sequence< OUString > SAL_CALL NestedKeyImpl::getStringListValue( )
throw(InvalidRegistryException, InvalidValueException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -578,7 +584,7 @@ Sequence< OUString > SAL_CALL NestedKeyImpl::getStringListValue( )
void SAL_CALL NestedKeyImpl::setStringListValue( const Sequence< OUString >& seqValue )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -587,10 +593,10 @@ void SAL_CALL NestedKeyImpl::setStringListValue( const Sequence< OUString >& seq
}
else if ( m_defaultKey.is() && m_defaultKey->isValid() )
{
- Reference<XRegistryKey> rootKey(m_xRegistry->m_localReg->getRootKey());
+ Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
m_localKey = rootKey->createKey(m_name);
m_localKey->setStringListValue(seqValue);
- m_state = m_xRegistry->m_state++;
+ m_state = m_pRegistry->m_state++;
}
else
{
@@ -602,7 +608,7 @@ void SAL_CALL NestedKeyImpl::setStringListValue( const Sequence< OUString >& seq
Sequence< sal_Int8 > SAL_CALL NestedKeyImpl::getBinaryValue( )
throw(InvalidRegistryException, InvalidValueException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -623,7 +629,7 @@ Sequence< sal_Int8 > SAL_CALL NestedKeyImpl::getBinaryValue( )
void SAL_CALL NestedKeyImpl::setBinaryValue( const Sequence< sal_Int8 >& value )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
computeChanges();
if ( m_localKey.is() && m_localKey->isValid() )
@@ -632,10 +638,10 @@ void SAL_CALL NestedKeyImpl::setBinaryValue( const Sequence< sal_Int8 >& value )
}
else if ( m_defaultKey.is() && m_defaultKey->isValid() )
{
- Reference<XRegistryKey> rootKey(m_xRegistry->m_localReg->getRootKey());
+ Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
m_localKey = rootKey->createKey(m_name);
m_localKey->setBinaryValue(value);
- m_state = m_xRegistry->m_state++;
+ m_state = m_pRegistry->m_state++;
}
else
{
@@ -647,7 +653,7 @@ void SAL_CALL NestedKeyImpl::setBinaryValue( const Sequence< sal_Int8 >& value )
Reference< XRegistryKey > SAL_CALL NestedKeyImpl::openKey( const OUString& aKeyName )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
if ( !m_localKey.is() && !m_defaultKey.is() )
{
throw InvalidRegistryException();
@@ -662,16 +668,16 @@ Reference< XRegistryKey > SAL_CALL NestedKeyImpl::openKey( const OUString& aKeyN
if ( m_localKey.is() && m_localKey->isValid() )
{
- localKey = m_xRegistry->m_localReg->getRootKey()->openKey(resolvedName);
+ localKey = m_pRegistry->m_localReg->getRootKey()->openKey(resolvedName);
}
if ( m_defaultKey.is() && m_defaultKey->isValid() )
{
- defaultKey = m_xRegistry->m_defaultReg->getRootKey()->openKey(resolvedName);
+ defaultKey = m_pRegistry->m_defaultReg->getRootKey()->openKey(resolvedName);
}
if ( localKey.is() || defaultKey.is() )
{
- return static_cast<XRegistryKey*>(new NestedKeyImpl(m_xRegistry.get(), localKey, defaultKey));
+ return static_cast<XRegistryKey*>(new NestedKeyImpl(m_pRegistry, localKey, defaultKey));
}
else
{
@@ -683,7 +689,7 @@ Reference< XRegistryKey > SAL_CALL NestedKeyImpl::openKey( const OUString& aKeyN
Reference< XRegistryKey > SAL_CALL NestedKeyImpl::createKey( const OUString& aKeyName )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
if ( (!m_localKey.is() && !m_defaultKey.is()) ||
(m_localKey.is() && m_localKey->isReadOnly()) )
{
@@ -699,17 +705,17 @@ Reference< XRegistryKey > SAL_CALL NestedKeyImpl::createKey( const OUString& aKe
{
Reference<XRegistryKey> localKey, defaultKey;
- localKey = m_xRegistry->m_localReg->getRootKey()->createKey(resolvedName);
+ localKey = m_pRegistry->m_localReg->getRootKey()->createKey(resolvedName);
if ( localKey.is() )
{
if ( m_defaultKey.is() && m_defaultKey->isValid() )
{
- defaultKey = m_xRegistry->m_defaultReg->getRootKey()->openKey(resolvedName);
+ defaultKey = m_pRegistry->m_defaultReg->getRootKey()->openKey(resolvedName);
}
- m_state = m_xRegistry->m_state++;
+ m_state = m_pRegistry->m_state++;
- return (static_cast<XRegistryKey*>(new NestedKeyImpl(m_xRegistry.get(), localKey, defaultKey)));
+ return (static_cast<XRegistryKey*>(new NestedKeyImpl(m_pRegistry, localKey, defaultKey)));
}
}
else
@@ -718,18 +724,18 @@ Reference< XRegistryKey > SAL_CALL NestedKeyImpl::createKey( const OUString& aKe
if ( m_defaultKey.is() && m_defaultKey->isValid() )
{
- Reference<XRegistryKey> rootKey(m_xRegistry->m_localReg->getRootKey());
+ Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
m_localKey = rootKey->createKey(m_name);
- localKey = m_xRegistry->m_localReg->getRootKey()->createKey(resolvedName);
+ localKey = m_pRegistry->m_localReg->getRootKey()->createKey(resolvedName);
if ( localKey.is() )
{
- defaultKey = m_xRegistry->m_defaultReg->getRootKey()->openKey(resolvedName);
+ defaultKey = m_pRegistry->m_defaultReg->getRootKey()->openKey(resolvedName);
- m_state = m_xRegistry->m_state++;
+ m_state = m_pRegistry->m_state++;
- return (static_cast<XRegistryKey*>(new NestedKeyImpl(m_xRegistry.get(), localKey, defaultKey)));
+ return (static_cast<XRegistryKey*>(new NestedKeyImpl(m_pRegistry, localKey, defaultKey)));
}
}
}
@@ -741,7 +747,7 @@ Reference< XRegistryKey > SAL_CALL NestedKeyImpl::createKey( const OUString& aKe
void SAL_CALL NestedKeyImpl::closeKey( )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
if ( m_localKey.is() && m_localKey->isValid() )
{
m_localKey->closeKey();
@@ -756,7 +762,7 @@ void SAL_CALL NestedKeyImpl::closeKey( )
void SAL_CALL NestedKeyImpl::deleteKey( const OUString& rKeyName )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
if ( m_localKey.is() && m_localKey->isValid() &&
!m_localKey->isReadOnly() )
{
@@ -767,7 +773,7 @@ void SAL_CALL NestedKeyImpl::deleteKey( const OUString& rKeyName )
throw InvalidRegistryException();
}
- m_xRegistry->m_localReg->getRootKey()->deleteKey(resolvedName);
+ m_pRegistry->m_localReg->getRootKey()->deleteKey(resolvedName);
}
else
{
@@ -779,7 +785,7 @@ void SAL_CALL NestedKeyImpl::deleteKey( const OUString& rKeyName )
Sequence< Reference< XRegistryKey > > SAL_CALL NestedKeyImpl::openKeys( )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
if ( !m_localKey.is() && !m_defaultKey.is() )
{
throw InvalidRegistryException();
@@ -858,7 +864,7 @@ Sequence< Reference< XRegistryKey > > SAL_CALL NestedKeyImpl::openKeys( )
Sequence< OUString > SAL_CALL NestedKeyImpl::getKeyNames( )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
if ( !m_localKey.is() && !m_defaultKey.is() )
{
throw InvalidRegistryException();
@@ -924,7 +930,7 @@ Sequence< OUString > SAL_CALL NestedKeyImpl::getKeyNames( )
sal_Bool SAL_CALL NestedKeyImpl::createLink( const OUString& aLinkName, const OUString& aLinkTarget )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
bool isCreated = false;
if ( !m_localKey.is() && !m_defaultKey.is() )
@@ -959,21 +965,21 @@ sal_Bool SAL_CALL NestedKeyImpl::createLink( const OUString& aLinkName, const OU
if ( m_localKey.is() && m_localKey->isValid() )
{
- isCreated = m_xRegistry->m_localReg->getRootKey()->createLink(resolvedName, aLinkTarget);
+ isCreated = m_pRegistry->m_localReg->getRootKey()->createLink(resolvedName, aLinkTarget);
}
else
{
if ( m_defaultKey.is() && m_defaultKey->isValid() )
{
- Reference<XRegistryKey> rootKey(m_xRegistry->m_localReg->getRootKey());
+ Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
m_localKey = rootKey->createKey(m_name);
- isCreated = m_xRegistry->m_localReg->getRootKey()->createLink(resolvedName, aLinkTarget);
+ isCreated = m_pRegistry->m_localReg->getRootKey()->createLink(resolvedName, aLinkTarget);
}
}
if ( isCreated )
- m_state = m_xRegistry->m_state++;
+ m_state = m_pRegistry->m_state++;
return isCreated;
}
@@ -982,7 +988,7 @@ sal_Bool SAL_CALL NestedKeyImpl::createLink( const OUString& aLinkName, const OU
void SAL_CALL NestedKeyImpl::deleteLink( const OUString& rLinkName )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
if ( !m_localKey.is() && !m_defaultKey.is() )
{
throw InvalidRegistryException();
@@ -1016,7 +1022,7 @@ void SAL_CALL NestedKeyImpl::deleteLink( const OUString& rLinkName )
if ( m_localKey.is() && m_localKey->isValid() &&
!m_localKey->isReadOnly() )
{
- m_xRegistry->m_localReg->getRootKey()->deleteLink(resolvedName);
+ m_pRegistry->m_localReg->getRootKey()->deleteLink(resolvedName);
}
else
{
@@ -1028,7 +1034,7 @@ void SAL_CALL NestedKeyImpl::deleteLink( const OUString& rLinkName )
OUString SAL_CALL NestedKeyImpl::getLinkTarget( const OUString& rLinkName )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
if ( !m_localKey.is() && !m_defaultKey.is() )
{
throw InvalidRegistryException();
@@ -1064,7 +1070,7 @@ OUString SAL_CALL NestedKeyImpl::getLinkTarget( const OUString& rLinkName )
{
try
{
- linkTarget = m_xRegistry->m_localReg->getRootKey()->getLinkTarget(resolvedName);
+ linkTarget = m_pRegistry->m_localReg->getRootKey()->getLinkTarget(resolvedName);
return linkTarget;
}
catch(InvalidRegistryException& )
@@ -1073,7 +1079,7 @@ OUString SAL_CALL NestedKeyImpl::getLinkTarget( const OUString& rLinkName )
}
if ( m_defaultKey.is() && m_defaultKey->isValid() )
- linkTarget = m_xRegistry->m_defaultReg->getRootKey()->getLinkTarget(resolvedName);
+ linkTarget = m_pRegistry->m_defaultReg->getRootKey()->getLinkTarget(resolvedName);
return linkTarget;
}
@@ -1082,7 +1088,7 @@ OUString SAL_CALL NestedKeyImpl::getLinkTarget( const OUString& rLinkName )
OUString SAL_CALL NestedKeyImpl::getResolvedName( const OUString& aKeyName )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
- Guard< Mutex > aGuard( m_xRegistry->m_mutex );
+ Guard< Mutex > aGuard( m_pRegistry->m_mutex );
if ( !m_localKey.is() && !m_defaultKey.is() )
{
throw InvalidRegistryException();
diff --git a/svtools/source/inc/unoiface.hxx b/svtools/source/inc/unoiface.hxx
index 485df3f70cf7..bbe2f6a17243 100644
--- a/svtools/source/inc/unoiface.hxx
+++ b/svtools/source/inc/unoiface.hxx
@@ -170,7 +170,7 @@ public:
class SVTXFormattedField : public VCLXSpinField
{
protected:
- css::uno::Reference<SvNumberFormatsSupplierObj> m_xCurrentSupplier;
+ SvNumberFormatsSupplierObj* m_pCurrentSupplier;
bool bIsStandardSupplier;
sal_Int32 nKeyToSetDelayed;
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index 4563803745ee..595106ee2f7c 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -810,7 +810,8 @@ void VCLXFileControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
SVTXFormattedField::SVTXFormattedField()
- :bIsStandardSupplier(true)
+ :m_pCurrentSupplier(nullptr)
+ ,bIsStandardSupplier(true)
,nKeyToSetDelayed(-1)
{
}
@@ -818,6 +819,11 @@ SVTXFormattedField::SVTXFormattedField()
SVTXFormattedField::~SVTXFormattedField()
{
+ if (m_pCurrentSupplier)
+ {
+ m_pCurrentSupplier->release();
+ m_pCurrentSupplier = nullptr;
+ }
}
@@ -1023,7 +1029,7 @@ css::uno::Any SVTXFormattedField::getProperty( const OUString& PropertyName ) th
css::uno::Reference< css::util::XNumberFormatsSupplier > SVTXFormattedField::getFormatsSupplier() const
{
- return m_xCurrentSupplier;
+ return css::uno::Reference< css::util::XNumberFormatsSupplier > (m_pCurrentSupplier);
}
css::uno::Any SVTXFormattedField::convertEffectiveValue(const css::uno::Any& rValue)
@@ -1311,12 +1317,15 @@ void SVTXFormattedField::setFormatsSupplier(const css::uno::Reference< css::util
if (!pNew)
return; // TODO : how to process ?
- m_xCurrentSupplier = pNew;
+ if (m_pCurrentSupplier)
+ m_pCurrentSupplier->release();
+ m_pCurrentSupplier = pNew;
+ m_pCurrentSupplier->acquire();
if (pField)
{
// save the actual value
css::uno::Any aCurrent = GetValue();
- pField->SetFormatter(m_xCurrentSupplier->GetNumberFormatter(), false);
+ pField->SetFormatter(m_pCurrentSupplier->GetNumberFormatter(), false);
if (nKeyToSetDelayed != -1)
{
pField->SetFormatKey(nKeyToSetDelayed);
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;
}
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index a54b3035a965..20830d55b552 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -197,7 +197,7 @@ class DisposeListenerGridBridge : public FmXDisposeListener
{
osl::Mutex m_aMutex;
DbGridControl& m_rParent;
- css::uno::Reference<FmXDisposeMultiplexer> m_xRealListener;
+ FmXDisposeMultiplexer* m_pRealListener;
public:
DisposeListenerGridBridge( DbGridControl& _rParent, const Reference< XComponent >& _rxObject);
@@ -209,20 +209,25 @@ public:
DisposeListenerGridBridge::DisposeListenerGridBridge(DbGridControl& _rParent, const Reference< XComponent >& _rxObject)
:FmXDisposeListener(m_aMutex)
,m_rParent(_rParent)
+ ,m_pRealListener(nullptr)
{
if (_rxObject.is())
{
- m_xRealListener = new FmXDisposeMultiplexer(this, _rxObject);
+ m_pRealListener = new FmXDisposeMultiplexer(this, _rxObject);
+ m_pRealListener->acquire();
}
}
DisposeListenerGridBridge::~DisposeListenerGridBridge()
{
- if (m_xRealListener.is())
+ if (m_pRealListener)
{
- m_xRealListener->dispose();
+ m_pRealListener->dispose();
+ m_pRealListener->release();
+ m_pRealListener = nullptr;
}
+
}
static const sal_uInt16 ControlMap[] =
diff --git a/ucbhelper/source/client/proxydecider.cxx b/ucbhelper/source/client/proxydecider.cxx
index 8b7630b9db17..5c04d7910794 100644
--- a/ucbhelper/source/client/proxydecider.cxx
+++ b/ucbhelper/source/client/proxydecider.cxx
@@ -772,15 +772,19 @@ void InternetProxyDecider_Impl::setNoProxyList(
InternetProxyDecider::InternetProxyDecider(
const uno::Reference< uno::XComponentContext>& rxContext )
-: m_xImpl( new proxydecider_impl::InternetProxyDecider_Impl( rxContext ) )
+: m_pImpl( new proxydecider_impl::InternetProxyDecider_Impl( rxContext ) )
{
+ m_pImpl->acquire();
}
InternetProxyDecider::~InternetProxyDecider()
{
// Break circular reference between config listener and notifier.
- m_xImpl->dispose();
+ m_pImpl->dispose();
+
+ // Let him go...
+ m_pImpl->release();
}
@@ -788,7 +792,7 @@ bool InternetProxyDecider::shouldUseProxy( const OUString & rProtocol,
const OUString & rHost,
sal_Int32 nPort ) const
{
- const InternetProxyServer & rData = m_xImpl->getProxy( rProtocol,
+ const InternetProxyServer & rData = m_pImpl->getProxy( rProtocol,
rHost,
nPort );
return !rData.aName.isEmpty();
@@ -800,7 +804,7 @@ const InternetProxyServer & InternetProxyDecider::getProxy(
const OUString & rHost,
sal_Int32 nPort ) const
{
- return m_xImpl->getProxy( rProtocol, rHost, nPort );
+ return m_pImpl->getProxy( rProtocol, rHost, nPort );
}
} // namespace ucbhelper
diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx
index 9d6a5d92fa10..97ae81c7b97a 100644
--- a/xmloff/source/draw/animationexport.cxx
+++ b/xmloff/source/draw/animationexport.cxx
@@ -531,7 +531,7 @@ private:
SvXMLExport& mrExport;
Reference< XInterface > mxExport;
Reference< XPropertySet > mxPageProps;
- rtl::Reference<XMLSdPropHdlFactory> mxSdPropHdlFactory;
+ XMLSdPropHdlFactory* mpSdPropHdlFactory;
};
AnimationsExporterImpl::AnimationsExporterImpl( SvXMLExport& rExport, const Reference< XPropertySet >& xPageProps )
@@ -548,11 +548,19 @@ AnimationsExporterImpl::AnimationsExporterImpl( SvXMLExport& rExport, const Refe
OSL_FAIL( "xmloff::AnimationsExporterImpl::AnimationsExporterImpl(), RuntimeException caught!" );
}
- mxSdPropHdlFactory = new XMLSdPropHdlFactory( mrExport.GetModel(), mrExport );
+ mpSdPropHdlFactory = new XMLSdPropHdlFactory( mrExport.GetModel(), mrExport );
+ // set lock to avoid deletion
+ mpSdPropHdlFactory->acquire();
}
AnimationsExporterImpl::~AnimationsExporterImpl()
{
+ // cleanup factory, decrease refcount. Should lead to destruction.
+ if(mpSdPropHdlFactory)
+ {
+ mpSdPropHdlFactory->release();
+ mpSdPropHdlFactory = nullptr;
+ }
}
void AnimationsExporterImpl::exportTransitionNode()
@@ -1519,7 +1527,7 @@ void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUString
}
//const XMLPropertyHandler* pHandler = static_cast<SdXMLExport*>(&mrExport)->GetSdPropHdlFactory()->GetPropertyHandler( nType );
- const XMLPropertyHandler* pHandler = mxSdPropHdlFactory->GetPropertyHandler( nType );
+ const XMLPropertyHandler* pHandler = mpSdPropHdlFactory->GetPropertyHandler( nType );
if( pHandler )
{
pHandler->exportXML( aString, rValue, mrExport.GetMM100UnitConverter() );
diff --git a/xmlscript/source/xmlflat_imexp/xmlbas_import.cxx b/xmlscript/source/xmlflat_imexp/xmlbas_import.cxx
index 3c99d74a870d..736afd5a6829 100644
--- a/xmlscript/source/xmlflat_imexp/xmlbas_import.cxx
+++ b/xmlscript/source/xmlflat_imexp/xmlbas_import.cxx
@@ -43,15 +43,23 @@ namespace xmlscript
BasicElementBase::BasicElementBase( const OUString& rLocalName,
const Reference< xml::input::XAttributes >& xAttributes,
BasicElementBase* pParent, BasicImport* pImport )
- :m_xImport( pImport )
- ,m_xParent( pParent )
+ :m_pImport( pImport )
+ ,m_pParent( pParent )
,m_aLocalName( rLocalName )
,m_xAttributes( xAttributes )
{
+ if ( m_pImport )
+ m_pImport->acquire();
+ if ( m_pParent )
+ m_pParent->acquire();
}
BasicElementBase::~BasicElementBase()
{
+ if ( m_pImport )
+ m_pImport->release();
+ if ( m_pParent )
+ m_pParent->release();
}
bool BasicElementBase::getBoolAttr( bool* pRet, const OUString& rAttrName,
@@ -87,7 +95,7 @@ namespace xmlscript
Reference< xml::input::XElement > BasicElementBase::getParent()
throw (RuntimeException, std::exception)
{
- return m_xParent;
+ return static_cast< xml::input::XElement* >( m_pParent );
}
OUString BasicElementBase::getLocalName()
@@ -100,8 +108,8 @@ namespace xmlscript
throw (RuntimeException, std::exception)
{
sal_Int32 nId = -1;
- if ( m_xImport.is() )
- nId = m_xImport->XMLNS_UID;
+ if ( m_pImport )
+ nId = m_pImport->XMLNS_UID;
return nId;
}
@@ -160,7 +168,7 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
{
Reference< xml::input::XElement > xElement;
- if ( nUid != m_xImport->XMLNS_UID )
+ if ( nUid != m_pImport->XMLNS_UID )
{
throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
}
@@ -168,12 +176,12 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
{
if ( xAttributes.is() )
{
- OUString aName = xAttributes->getValueByUidName( m_xImport->XMLNS_UID, "name" );
+ OUString aName = xAttributes->getValueByUidName( m_pImport->XMLNS_UID, "name" );
- OUString aStorageURL = xAttributes->getValueByUidName(m_xImport->XMLNS_XLINK_UID, "href" );
+ OUString aStorageURL = xAttributes->getValueByUidName(m_pImport->XMLNS_XLINK_UID, "href" );
bool bReadOnly = false;
- getBoolAttr( &bReadOnly,"readonly", xAttributes, m_xImport->XMLNS_UID );
+ getBoolAttr( &bReadOnly,"readonly", xAttributes, m_pImport->XMLNS_UID );
if ( m_xLibContainer.is() )
{
@@ -182,7 +190,7 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
Reference< container::XNameAccess > xLib(
m_xLibContainer->createLibraryLink( aName, aStorageURL, bReadOnly ) );
if ( xLib.is() )
- xElement.set( new BasicElementBase( rLocalName, xAttributes, this, m_xImport.get() ) );
+ xElement.set( new BasicElementBase( rLocalName, xAttributes, this, m_pImport ) );
}
catch ( const container::ElementExistException& e )
{
@@ -201,10 +209,10 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
if ( xAttributes.is() )
{
- OUString aName = xAttributes->getValueByUidName( m_xImport->XMLNS_UID, "name" );
+ OUString aName = xAttributes->getValueByUidName( m_pImport->XMLNS_UID, "name" );
bool bReadOnly = false;
- getBoolAttr( &bReadOnly, "readonly", xAttributes, m_xImport->XMLNS_UID );
+ getBoolAttr( &bReadOnly, "readonly", xAttributes, m_pImport->XMLNS_UID );
if ( m_xLibContainer.is() )
{
@@ -222,7 +230,7 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
}
if ( xLib.is() )
- xElement.set( new BasicEmbeddedLibraryElement( rLocalName, xAttributes, this, m_xImport.get(), m_xLibContainer, aName, bReadOnly ) );
+ xElement.set( new BasicEmbeddedLibraryElement( rLocalName, xAttributes, this, m_pImport, m_xLibContainer, aName, bReadOnly ) );
}
catch ( const lang::IllegalArgumentException& e )
{
@@ -276,7 +284,7 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
{
Reference< xml::input::XElement > xElement;
- if ( nUid != m_xImport->XMLNS_UID )
+ if ( nUid != m_pImport->XMLNS_UID )
{
throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
}
@@ -284,10 +292,10 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
{
if ( xAttributes.is() )
{
- OUString aName = xAttributes->getValueByUidName(m_xImport->XMLNS_UID, "name" );
+ OUString aName = xAttributes->getValueByUidName(m_pImport->XMLNS_UID, "name" );
if ( m_xLib.is() && !aName.isEmpty() )
- xElement.set( new BasicModuleElement( rLocalName, xAttributes, this, m_xImport.get(), m_xLib, aName ) );
+ xElement.set( new BasicModuleElement( rLocalName, xAttributes, this, m_pImport, m_xLib, aName ) );
}
}
else
@@ -328,7 +336,7 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
Reference< xml::input::XElement > xElement;
- if ( nUid != m_xImport->XMLNS_UID )
+ if ( nUid != m_pImport->XMLNS_UID )
{
throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
}
@@ -339,7 +347,7 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
if ( xAttributes.is() )
{
if ( m_xLib.is() && !m_aName.isEmpty() )
- xElement.set( new BasicSourceCodeElement( rLocalName, xAttributes, this, m_xImport.get(), m_xLib, m_aName ) );
+ xElement.set( new BasicSourceCodeElement( rLocalName, xAttributes, this, m_pImport, m_xLib, m_aName ) );
}
}
else
diff --git a/xmlscript/source/xmlflat_imexp/xmlbas_import.hxx b/xmlscript/source/xmlflat_imexp/xmlbas_import.hxx
index d38fa73f0ed3..0eecb0dd1cd3 100644
--- a/xmlscript/source/xmlflat_imexp/xmlbas_import.hxx
+++ b/xmlscript/source/xmlflat_imexp/xmlbas_import.hxx
@@ -43,8 +43,8 @@ namespace xmlscript
class BasicElementBase : public BasicElementBase_BASE
{
protected:
- css::uno::Reference<BasicImport> m_xImport;
- css::uno::Reference<BasicElementBase> m_xParent;
+ BasicImport* m_pImport;
+ BasicElementBase* m_pParent;
OUString m_aLocalName;
css::uno::Reference< css::xml::input::XAttributes > m_xAttributes;
diff --git a/xmlscript/source/xmllib_imexp/imp_share.hxx b/xmlscript/source/xmllib_imexp/imp_share.hxx
index a1ce3561cc6c..a28fb2f7cd33 100644
--- a/xmlscript/source/xmllib_imexp/imp_share.hxx
+++ b/xmlscript/source/xmllib_imexp/imp_share.hxx
@@ -155,8 +155,8 @@ class LibElementBase
: public ::cppu::WeakImplHelper< css::xml::input::XElement >
{
protected:
- css::uno::Reference<LibraryImport> mxImport;
- css::uno::Reference<LibElementBase> mxParent;
+ LibraryImport * _pImport;
+ LibElementBase * _pParent;
OUString _aLocalName;
css::uno::Reference< css::xml::input::XAttributes > _xAttributes;
diff --git a/xmlscript/source/xmllib_imexp/xmllib_import.cxx b/xmlscript/source/xmllib_imexp/xmllib_import.cxx
index cc54d84cb4c7..891919228d08 100644
--- a/xmlscript/source/xmllib_imexp/xmllib_import.cxx
+++ b/xmlscript/source/xmllib_imexp/xmllib_import.cxx
@@ -33,7 +33,7 @@ namespace xmlscript
Reference< xml::input::XElement > LibElementBase::getParent()
throw (RuntimeException, std::exception)
{
- return mxParent;
+ return static_cast< xml::input::XElement * >( _pParent );
}
OUString LibElementBase::getLocalName()
@@ -45,7 +45,7 @@ OUString LibElementBase::getLocalName()
sal_Int32 LibElementBase::getUid()
throw (RuntimeException, std::exception)
{
- return mxImport->XMLNS_LIBRARY_UID;
+ return _pImport->XMLNS_LIBRARY_UID;
}
Reference< xml::input::XAttributes > LibElementBase::getAttributes()
@@ -88,15 +88,28 @@ LibElementBase::LibElementBase(
OUString const & rLocalName,
Reference< xml::input::XAttributes > const & xAttributes,
LibElementBase * pParent, LibraryImport * pImport )
- : mxImport( pImport )
- , mxParent( pParent )
+ : _pImport( pImport )
+ , _pParent( pParent )
, _aLocalName( rLocalName )
, _xAttributes( xAttributes )
{
+ _pImport->acquire();
+
+ if (_pParent)
+ {
+ _pParent->acquire();
+ }
}
LibElementBase::~LibElementBase()
{
+ _pImport->release();
+
+ if (_pParent)
+ {
+ _pParent->release();
+ }
+
SAL_INFO("xmlscript.xmllib", "LibElementBase::~LibElementBase(): " << _aLocalName );
}
@@ -169,7 +182,7 @@ Reference< xml::input::XElement > LibrariesElement::startChildElement(
Reference< xml::input::XAttributes > const & xAttributes )
throw (xml::sax::SAXException, RuntimeException, std::exception)
{
- if (mxImport->XMLNS_LIBRARY_UID != nUid)
+ if (_pImport->XMLNS_LIBRARY_UID != nUid)
{
throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
}
@@ -179,14 +192,14 @@ Reference< xml::input::XElement > LibrariesElement::startChildElement(
LibDescriptor aDesc;
aDesc.bLink = aDesc.bReadOnly = aDesc.bPasswordProtected = aDesc.bPreload = false;
- aDesc.aName = xAttributes->getValueByUidName(mxImport->XMLNS_LIBRARY_UID, "name" );
- aDesc.aStorageURL = xAttributes->getValueByUidName( mxImport->XMLNS_XLINK_UID, "href" );
- getBoolAttr(&aDesc.bLink, "link", xAttributes, mxImport->XMLNS_LIBRARY_UID );
- getBoolAttr(&aDesc.bReadOnly, "readonly", xAttributes, mxImport->XMLNS_LIBRARY_UID );
- getBoolAttr(&aDesc.bPasswordProtected, "passwordprotected", xAttributes, mxImport->XMLNS_LIBRARY_UID );
+ aDesc.aName = xAttributes->getValueByUidName(_pImport->XMLNS_LIBRARY_UID, "name" );
+ aDesc.aStorageURL = xAttributes->getValueByUidName( _pImport->XMLNS_XLINK_UID, "href" );
+ getBoolAttr(&aDesc.bLink, "link", xAttributes, _pImport->XMLNS_LIBRARY_UID );
+ getBoolAttr(&aDesc.bReadOnly, "readonly", xAttributes, _pImport->XMLNS_LIBRARY_UID );
+ getBoolAttr(&aDesc.bPasswordProtected, "passwordprotected", xAttributes, _pImport->XMLNS_LIBRARY_UID );
mLibDescriptors.push_back( aDesc );
- return new LibraryElement( rLocalName, xAttributes, this, mxImport.get() );
+ return new LibraryElement( rLocalName, xAttributes, this, _pImport );
}
else
{
@@ -197,13 +210,13 @@ Reference< xml::input::XElement > LibrariesElement::startChildElement(
void LibrariesElement::endElement()
throw (xml::sax::SAXException, RuntimeException, std::exception)
{
- sal_Int32 nLibCount = mxImport->mpLibArray->mnLibCount = (sal_Int32)mLibDescriptors.size();
- mxImport->mpLibArray->mpLibs = new LibDescriptor[ nLibCount ];
+ sal_Int32 nLibCount = _pImport->mpLibArray->mnLibCount = (sal_Int32)mLibDescriptors.size();
+ _pImport->mpLibArray->mpLibs = new LibDescriptor[ nLibCount ];
for( sal_Int32 i = 0 ; i < nLibCount ; i++ )
{
const LibDescriptor& rLib = mLibDescriptors[i];
- mxImport->mpLibArray->mpLibs[i] = rLib;
+ _pImport->mpLibArray->mpLibs[i] = rLib;
}
}
@@ -213,18 +226,18 @@ Reference< xml::input::XElement > LibraryElement::startChildElement(
Reference< xml::input::XAttributes > const & xAttributes )
throw (xml::sax::SAXException, RuntimeException, std::exception)
{
- if (mxImport->XMLNS_LIBRARY_UID != nUid)
+ if (_pImport->XMLNS_LIBRARY_UID != nUid)
{
throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
}
// library
else if ( rLocalName == "element" )
{
- OUString aValue( xAttributes->getValueByUidName(mxImport->XMLNS_LIBRARY_UID, "name" ) );
+ OUString aValue( xAttributes->getValueByUidName(_pImport->XMLNS_LIBRARY_UID, "name" ) );
if (!aValue.isEmpty())
mElements.push_back( aValue );
- return new LibElementBase( rLocalName, xAttributes, this, mxImport.get() );
+ return new LibElementBase( rLocalName, xAttributes, this, _pImport );
}
else
{
@@ -241,9 +254,9 @@ void LibraryElement::endElement()
for( sal_Int32 i = 0 ; i < nElementCount ; i++ )
pElementNames[i] = mElements[i];
- LibDescriptor* pLib = mxImport->mpLibDesc;
+ LibDescriptor* pLib = _pImport->mpLibDesc;
if( !pLib )
- pLib = &static_cast< LibrariesElement* >( mxParent.get() )->mLibDescriptors.back();
+ pLib = &static_cast< LibrariesElement* >( _pParent )->mLibDescriptors.back();
pLib->aElementNames = aElementNames;
}
diff --git a/xmlscript/source/xmlmod_imexp/imp_share.hxx b/xmlscript/source/xmlmod_imexp/imp_share.hxx
index b37b865971d5..05ca0944ce04 100644
--- a/xmlscript/source/xmlmod_imexp/imp_share.hxx
+++ b/xmlscript/source/xmlmod_imexp/imp_share.hxx
@@ -85,8 +85,8 @@ class ModuleElement
: public ::cppu::WeakImplHelper< css::xml::input::XElement >
{
protected:
- css::uno::Reference<ModuleImport> mxImport;
- css::uno::Reference<ModuleElement> mxParent;
+ ModuleImport * _pImport;
+ ModuleElement * _pParent;
OUString _aLocalName;
css::uno::Reference< css::xml::input::XAttributes > _xAttributes;
diff --git a/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx b/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx
index 0fdc1174c5b7..f724ff7593ba 100644
--- a/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx
+++ b/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx
@@ -33,7 +33,7 @@ namespace xmlscript
Reference< xml::input::XElement > ModuleElement::getParent()
throw (RuntimeException, std::exception)
{
- return mxParent;
+ return static_cast< xml::input::XElement * >( _pParent );
}
OUString ModuleElement::getLocalName()
throw (RuntimeException, std::exception)
@@ -43,7 +43,7 @@ OUString ModuleElement::getLocalName()
sal_Int32 ModuleElement::getUid()
throw (RuntimeException, std::exception)
{
- return mxImport->XMLNS_SCRIPT_UID;
+ return _pImport->XMLNS_SCRIPT_UID;
}
Reference< xml::input::XAttributes > ModuleElement::getAttributes()
throw (RuntimeException, std::exception)
@@ -73,7 +73,7 @@ void ModuleElement::processingInstruction(
void ModuleElement::endElement()
throw (xml::sax::SAXException, RuntimeException, std::exception)
{
- mxImport->mrModuleDesc.aCode = _strBuffer.makeStringAndClear();
+ _pImport->mrModuleDesc.aCode = _strBuffer.makeStringAndClear();
}
Reference< xml::input::XElement > ModuleElement::startChildElement(
@@ -88,15 +88,28 @@ ModuleElement::ModuleElement(
OUString const & rLocalName,
Reference< xml::input::XAttributes > const & xAttributes,
ModuleElement * pParent, ModuleImport * pImport )
- : mxImport( pImport )
- , mxParent( pParent )
+ : _pImport( pImport )
+ , _pParent( pParent )
, _aLocalName( rLocalName )
, _xAttributes( xAttributes )
{
+ _pImport->acquire();
+
+ if (_pParent)
+ {
+ _pParent->acquire();
+ }
}
ModuleElement::~ModuleElement()
{
+ _pImport->release();
+
+ if (_pParent)
+ {
+ _pParent->release();
+ }
+
SAL_INFO("xmlscript.xmlmod", "ModuleElement::~ModuleElement(): " << _aLocalName );
}