You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2007/02/06 09:47:57 UTC

svn commit: r504037 - /xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMDocumentImpl.cpp

Author: amassari
Date: Tue Feb  6 00:47:57 2007
New Revision: 504037

URL: http://svn.apache.org/viewvc?view=rev&rev=504037
Log:
When invoking the userData handlers, first build a snapshot of the map, so that the callbacks can update it safely

Modified:
    xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMDocumentImpl.cpp

Modified: xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMDocumentImpl.cpp
URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMDocumentImpl.cpp?view=diff&rev=504037&r1=504036&r2=504037
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMDocumentImpl.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMDocumentImpl.cpp Tue Feb  6 00:47:57 2007
@@ -1271,11 +1271,20 @@
     if (fUserDataTable) {
         RefHash2KeysTableOfEnumerator<DOMUserDataRecord> userDataEnum(fUserDataTable, false, fMemoryManager);
         userDataEnum.setPrimaryKey(n);
+        // Create a snapshot of the handlers to be called, as the "handle" callback could be invalidating the enumerator by calling
+        // setUserData on the dst node
+        ValueVectorOf< int > snapshot(3, fMemoryManager);
         while (userDataEnum.hasMoreElements()) {
             // get the key
             void* key;
             int key2;
             userDataEnum.nextElementKey(key,key2);
+            snapshot.addElement(key2);
+        }
+        ValueVectorEnumerator< int > snapshotEnum(&snapshot);
+        while(snapshotEnum.hasMoreElements())
+        {
+            int key2=snapshotEnum.nextElement();
 
             // get the DOMUserDataRecord
             DOMUserDataRecord* userDataRecord = fUserDataTable->get((void*)n,key2);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org