unoxml/source/dom/document.cxx           |    4 ++--
 unoxml/source/dom/element.cxx            |    5 ++---
 unoxml/source/events/eventdispatcher.cxx |    8 ++++----
 3 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit 63058a4f2b0809748d43c7f45dcf85dbcd1dfcb7
Author:     Noel <noel.gran...@collabora.co.uk>
AuthorDate: Fri Feb 19 11:26:46 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Feb 19 11:24:22 2021 +0100

    loplugin:refcounting in unoxml
    
    Change-Id: I979b309271809b64d6f04cbccd14e0ee3b09ec81
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111198
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

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(),
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to