diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-02-19 11:26:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-19 11:24:22 +0100 |
commit | 63058a4f2b0809748d43c7f45dcf85dbcd1dfcb7 (patch) | |
tree | d38ca3a815ad448ede596dfe64c88f8996927a88 /unoxml | |
parent | f4b1095451092cb251f15f160d00510e7d75aa46 (diff) |
loplugin:refcounting in unoxml
Change-Id: I979b309271809b64d6f04cbccd14e0ee3b09ec81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111198
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unoxml')
-rw-r--r-- | unoxml/source/dom/document.cxx | 4 | ||||
-rw-r--r-- | unoxml/source/dom/element.cxx | 5 | ||||
-rw-r--r-- | unoxml/source/events/eventdispatcher.cxx | 8 |
3 files changed, 8 insertions, 9 deletions
diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index db93dcad847a..27db21ebe09b 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -937,7 +937,7 @@ namespace DOM Reference< XEvent > SAL_CALL CDocument::createEvent(const OUString& aType) { // does not need mutex currently - events::CEvent *pEvent = nullptr; + rtl::Reference<events::CEvent> pEvent; if ( aType == "DOMSubtreeModified" || aType == "DOMNodeInserted" || aType == "DOMNodeRemoved" || aType == "DOMNodeRemovedFromDocument" || aType == "DOMNodeInsertedIntoDocument" || aType == "DOMAttrModified" || aType == "DOMCharacterDataModified") @@ -956,7 +956,7 @@ namespace DOM { pEvent = new events::CEvent; } - return Reference< XEvent >(pEvent); + return pEvent; } // css::xml::sax::XSAXSerializable diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx index 988d7f1b9c32..e82f2edab4f2 100644 --- a/unoxml/source/dom/element.cxx +++ b/unoxml/source/dom/element.cxx @@ -56,7 +56,7 @@ namespace DOM void CElement::saxify(const Reference< XDocumentHandler >& i_xHandler) { if (!i_xHandler.is()) throw RuntimeException(); - comphelper::AttributeList *pAttrs = + rtl::Reference<comphelper::AttributeList> pAttrs = new comphelper::AttributeList(); OUString type = ""; // add namespace definitions to attributes @@ -90,8 +90,7 @@ namespace DOM OUString name = (prefix.isEmpty()) ? getLocalName() : prefix + ":" + getLocalName(); - Reference< XAttributeList > xAttrList(pAttrs); - i_xHandler->startElement(name, xAttrList); + i_xHandler->startElement(name, pAttrs); // recurse for (xmlNodePtr pChild = m_aNodePtr->children; pChild != nullptr; pChild = pChild->next) { diff --git a/unoxml/source/events/eventdispatcher.cxx b/unoxml/source/events/eventdispatcher.cxx index fc396ee9dc76..201f682f7d66 100644 --- a/unoxml/source/events/eventdispatcher.cxx +++ b/unoxml/source/events/eventdispatcher.cxx @@ -117,7 +117,7 @@ namespace DOM::events { if (captureListeners.empty() && targetListeners.empty()) return; - CEvent *pEvent = nullptr; // pointer to internal event representation + rtl::Reference<CEvent> pEvent; // pointer to internal event representation OUString const aType = i_xEvent->getType(); if (aType == "DOMSubtreeModified" || @@ -133,7 +133,7 @@ namespace DOM::events { // dispatch a mutation event // we need to clone the event in order to have complete control // over the implementation - CMutationEvent* pMEvent = new CMutationEvent; + rtl::Reference<CMutationEvent> pMEvent = new CMutationEvent; pMEvent->initMutationEvent( aType, aMEvent->getBubbles(), aMEvent->getCancelable(), aMEvent->getRelatedNode(), aMEvent->getPrevValue(), @@ -146,7 +146,7 @@ namespace DOM::events { aType == "DOMActivate" ) { Reference< XUIEvent > const aUIEvent(i_xEvent, UNO_QUERY_THROW); - CUIEvent* pUIEvent = new CUIEvent; + rtl::Reference<CUIEvent> pUIEvent = new CUIEvent; pUIEvent->initUIEvent(aType, aUIEvent->getBubbles(), aUIEvent->getCancelable(), aUIEvent->getView(), aUIEvent->getDetail()); @@ -161,7 +161,7 @@ namespace DOM::events { { Reference< XMouseEvent > const aMouseEvent(i_xEvent, UNO_QUERY_THROW); - CMouseEvent *pMouseEvent = new CMouseEvent; + rtl::Reference<CMouseEvent> pMouseEvent = new CMouseEvent; pMouseEvent->initMouseEvent(aType, aMouseEvent->getBubbles(), aMouseEvent->getCancelable(), aMouseEvent->getView(), aMouseEvent->getDetail(), |