From 33671dc90b3c23599d18dd0613cc8d1235e0dce0 Mon Sep 17 00:00:00 2001
From: Khaled Noaman <knoaman@apache.org>
Date: Thu, 20 Nov 2003 18:09:18 +0000
Subject: [PATCH] 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
---
 src/xercesc/validators/common/AllContentModel.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/xercesc/validators/common/AllContentModel.cpp b/src/xercesc/validators/common/AllContentModel.cpp
index c5524299d..ed07b871c 100644
--- a/src/xercesc/validators/common/AllContentModel.cpp
+++ b/src/xercesc/validators/common/AllContentModel.cpp
@@ -56,6 +56,10 @@
 
 /*
  * $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
  * Memory manager implementation: pass per instance manager.
  *
@@ -139,13 +143,15 @@ AllContentModel::AllContentModel( ContentSpecNode* const parentContentSpec
     fChildren = (QName**) fMemoryManager->allocate(fCount * sizeof(QName*)); //new QName*[fCount];
     fChildOptional = (bool*) fMemoryManager->allocate(fCount * sizeof(bool)); //new bool[fCount];
     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);
     }
 }
 
 AllContentModel::~AllContentModel()
 {
+    for (unsigned int index = 0; index < fCount; index++)
+        delete fChildren[index];
     fMemoryManager->deallocate(fChildren); //delete [] fChildren;
     fMemoryManager->deallocate(fChildOptional); //delete [] fChildOptional;
 }
-- 
GitLab