Skip to content
Snippets Groups Projects
Commit 33671dc9 authored by Khaled Noaman's avatar Khaled Noaman
Browse files

Store a copy of each child, instead of a reference, as the content spec node

tree is not guaranteed to be persistent.


git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@175413 13f79535-47bb-0310-9956-ffa450edef68
parent 9b44a54d
No related branches found
No related tags found
No related merge requests found
...@@ -56,6 +56,10 @@ ...@@ -56,6 +56,10 @@
/* /*
* $Log$ * $Log$
* Revision 1.6 2003/11/20 18:09:18 knoaman
* Store a copy of each child, instead of a reference, as the content spec node
* tree is not guaranteed to be persistent.
*
* Revision 1.5 2003/05/18 14:02:06 knoaman * Revision 1.5 2003/05/18 14:02:06 knoaman
* Memory manager implementation: pass per instance manager. * Memory manager implementation: pass per instance manager.
* *
...@@ -139,13 +143,15 @@ AllContentModel::AllContentModel( ContentSpecNode* const parentContentSpec ...@@ -139,13 +143,15 @@ AllContentModel::AllContentModel( ContentSpecNode* const parentContentSpec
fChildren = (QName**) fMemoryManager->allocate(fCount * sizeof(QName*)); //new QName*[fCount]; fChildren = (QName**) fMemoryManager->allocate(fCount * sizeof(QName*)); //new QName*[fCount];
fChildOptional = (bool*) fMemoryManager->allocate(fCount * sizeof(bool)); //new bool[fCount]; fChildOptional = (bool*) fMemoryManager->allocate(fCount * sizeof(bool)); //new bool[fCount];
for (unsigned int index = 0; index < fCount; index++) { for (unsigned int index = 0; index < fCount; index++) {
fChildren[index] = children.elementAt(index); fChildren[index] = new (fMemoryManager) QName(*(children.elementAt(index)));
fChildOptional[index] = childOptional.elementAt(index); fChildOptional[index] = childOptional.elementAt(index);
} }
} }
AllContentModel::~AllContentModel() AllContentModel::~AllContentModel()
{ {
for (unsigned int index = 0; index < fCount; index++)
delete fChildren[index];
fMemoryManager->deallocate(fChildren); //delete [] fChildren; fMemoryManager->deallocate(fChildren); //delete [] fChildren;
fMemoryManager->deallocate(fChildOptional); //delete [] fChildOptional; fMemoryManager->deallocate(fChildOptional); //delete [] fChildOptional;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment