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:50:17 UTC
svn commit: r504040 -
/xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp
Author: amassari
Date: Tue Feb 6 00:50:16 2007
New Revision: 504040
URL: http://svn.apache.org/viewvc?view=rev&rev=504040
Log:
When invoking the userData handlers, first build a snapshot of the map, so that the callbacks can update it safely
Modified:
xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp
Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp?view=diff&rev=504040&r1=504039&r2=504040
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp Tue Feb 6 00:50:16 2007
@@ -1011,7 +1011,7 @@
case DOCUMENT_NODE:
case DOCUMENT_TYPE_NODE:
throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager());
- case ATTRIBUTE_NODE:
+ case ATTRIBUTE_NODE:
{
DOMAttr* sourceAttr=(DOMAttr*)sourceNode;
DOMElement* sourceAttrElem=sourceAttr->getOwnerElement();
@@ -1314,11 +1314,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