--- a/webservices/wsxml/src/senbaseelement.cpp Tue Aug 31 16:18:26 2010 +0300
+++ b/webservices/wsxml/src/senbaseelement.cpp Wed Sep 01 12:28:05 2010 +0100
@@ -269,7 +269,9 @@
CSenBaseAttribute* pAttribute = CSenBaseAttribute::NewL(aQName,
aLocalName,
aValue);
+ CleanupStack::PushL(pAttribute);
AddAttributeL(pAttribute);
+ CleanupStack::Pop(pAttribute);
}
return aValue;
}
@@ -487,8 +489,16 @@
CSenBaseAttribute* pAttr = FindAttr(aName);
if (pAttr == NULL)
{
- User::LeaveIfError(iAttrs.Append(CSenBaseAttribute::NewL(aName,
- aValue)));
+ //Create new baseAttribute object
+ CSenBaseAttribute* newBaseAttribute = CSenBaseAttribute::NewL(aName, aValue);
+ //Push to cleanupstack
+ CleanupStack::PushL(newBaseAttribute);
+
+ //Add the new baseAttribute to existing Attribute list
+ User::LeaveIfError(iAttrs.Append(newBaseAttribute));
+
+ //Pop from CleanupStack
+ CleanupStack::Pop(newBaseAttribute);
}
else
{
@@ -632,7 +642,19 @@
EXPORT_C CSenElement& CSenBaseElement::AddElementL(const TDesC8& aNsUri,
const TDesC8& aLocalName)
{
- return AddElementL(*CSenBaseElement::NewL(aNsUri, aLocalName));
+ //Create new baseElement
+ CSenBaseElement *newBaseElement = CSenBaseElement::NewL(aNsUri, aLocalName);
+ //Push it to CleanupStack
+ CleanupStack::PushL(newBaseElement);
+
+ //Add the baseElement
+ CSenElement& newAddedElement = AddElementL(*newBaseElement);
+
+ //Pop baseElement from CleanupStack
+ CleanupStack::Pop(newBaseElement);
+
+ //Return the newly added element (got from the AddElement() API)
+ return newAddedElement;
}
EXPORT_C CSenElement& CSenBaseElement::AddElementL(
@@ -641,12 +663,36 @@
const TDesC8& aQName
)
{
- return AddElementL(*CSenBaseElement::NewL(aNsUri, aLocalName, aQName));
+ //Create new baseElement
+ CSenBaseElement *newBaseElement = CSenBaseElement::NewL(aNsUri, aLocalName, aQName);
+ //Push it to CleanupStack
+ CleanupStack::PushL(newBaseElement);
+
+ //Add the baseElement
+ CSenElement& newAddedElement = AddElementL(*newBaseElement);
+
+ //Pop baseElement from CleanupStack
+ CleanupStack::Pop(newBaseElement);
+
+ //Return the newly added element (got from the AddElement() API)
+ return newAddedElement;
}
EXPORT_C CSenElement& CSenBaseElement::AddElementL(const TDesC8& aLocalName)
{
- return AddElementL(*CSenBaseElement::NewL(aLocalName));
+ //Create new baseElement
+ CSenBaseElement *newBaseElement = CSenBaseElement::NewL(aLocalName);
+ //Push it to CleanupStack
+ CleanupStack::PushL(newBaseElement);
+
+ //Add the baseElement
+ CSenElement& newAddedElement = AddElementL(*newBaseElement);
+
+ //Pop baseElement from CleanupStack
+ CleanupStack::Pop(newBaseElement);
+
+ //Return the newly added element (got from the AddElement() API)
+ return newAddedElement;
}
EXPORT_C CSenElement* CSenBaseElement::RemoveElement(CSenElement& aElement)