summaryrefslogtreecommitdiff
path: root/xmlscript/source/xmlmod_imexp
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-23 13:53:42 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-24 06:54:06 +0000
commit111de438ea3e512a541281dc0716cc728ea8d152 (patch)
tree2c9ca866e79ed0cfc9299e553a87239345c515a6 /xmlscript/source/xmlmod_imexp
parentd3f21849ec8580fdb59a1f0b35453657f4050e0f (diff)
remove some manual ref-counting
triggered when I noticed a class doing acquire() in the constructor and then release() in the destructor. found mostly by git grep -n -B5 -e '->release()' Change-Id: Ie1abeaed75c1f861df185e3bde680272dbadc97f Reviewed-on: https://gerrit.libreoffice.org/25363 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'xmlscript/source/xmlmod_imexp')
-rw-r--r--xmlscript/source/xmlmod_imexp/imp_share.hxx4
-rw-r--r--xmlscript/source/xmlmod_imexp/xmlmod_import.cxx23
2 files changed, 7 insertions, 20 deletions
diff --git a/xmlscript/source/xmlmod_imexp/imp_share.hxx b/xmlscript/source/xmlmod_imexp/imp_share.hxx
index 05ca0944ce04..b37b865971d5 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:
- ModuleImport * _pImport;
- ModuleElement * _pParent;
+ css::uno::Reference<ModuleImport> mxImport;
+ css::uno::Reference<ModuleElement> mxParent;
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 f724ff7593ba..0fdc1174c5b7 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 static_cast< xml::input::XElement * >( _pParent );
+ return mxParent;
}
OUString ModuleElement::getLocalName()
throw (RuntimeException, std::exception)
@@ -43,7 +43,7 @@ OUString ModuleElement::getLocalName()
sal_Int32 ModuleElement::getUid()
throw (RuntimeException, std::exception)
{
- return _pImport->XMLNS_SCRIPT_UID;
+ return mxImport->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)
{
- _pImport->mrModuleDesc.aCode = _strBuffer.makeStringAndClear();
+ mxImport->mrModuleDesc.aCode = _strBuffer.makeStringAndClear();
}
Reference< xml::input::XElement > ModuleElement::startChildElement(
@@ -88,28 +88,15 @@ ModuleElement::ModuleElement(
OUString const & rLocalName,
Reference< xml::input::XAttributes > const & xAttributes,
ModuleElement * pParent, ModuleImport * pImport )
- : _pImport( pImport )
- , _pParent( pParent )
+ : mxImport( pImport )
+ , mxParent( 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 );
}