tng         2002/08/16 09:02:53

  Modified:    c/src/xercesc/dom/impl DOMDocumentImpl.cpp
                        DOMDocumentImpl.hpp DOMDocumentTypeImpl.cpp
  Log:
  [Bug 11360] Release user data using handler.
  
  Revision  Changes    Path
  1.19      +20 -2     xml-xerces/c/src/xercesc/dom/impl/DOMDocumentImpl.cpp
  
  Index: DOMDocumentImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMDocumentImpl.cpp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- DOMDocumentImpl.cpp       16 Aug 2002 13:39:27 -0000      1.18
  +++ DOMDocumentImpl.cpp       16 Aug 2002 16:02:53 -0000      1.19
  @@ -1212,7 +1212,10 @@
       DOMDocument* doc = (DOMDocument*) this;
       fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
   
  -    // release the docType as well
  +    // notify userdatahandler first
  +    releaseDocNotifyUserData(this);
  +
  +    // release the docType in case it was created from heap
       if (fDocType) {
           castToNodeImpl(fDocType)->isToBeReleased(true);
           fDocType->release();
  @@ -1221,6 +1224,21 @@
       // delete the document memory pool
       delete doc;
   };
  +
  +void DOMDocumentImpl::releaseDocNotifyUserData(DOMNode* object)
  +{
  +    DOMNode *child = object->getFirstChild();
  +    if (child != 0)
  +    {
  +        while( child != 0)
  +        {
  +            releaseDocNotifyUserData(child);
  +            child = child->getNextSibling();
  +        }
  +    }
  +    else
  +        
castToNodeImpl(object)->callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
  +}
   
   void DOMDocumentImpl::release(DOMNode* object, NodeObjectType type)
   {
  
  
  
  1.9       +2 -1      xml-xerces/c/src/xercesc/dom/impl/DOMDocumentImpl.hpp
  
  Index: DOMDocumentImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMDocumentImpl.hpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DOMDocumentImpl.hpp       8 Aug 2002 14:15:47 -0000       1.8
  +++ DOMDocumentImpl.hpp       16 Aug 2002 16:02:53 -0000      1.9
  @@ -299,6 +299,7 @@
       const XMLCh*                 getPooledString(const XMLCh *src);
       void                         deleteHeap();
       void                         release(DOMNode* object, NodeObjectType type);
  +    void                         releaseDocNotifyUserData(DOMNode* object);
       void                         releaseBuffer(DOMBuffer* buffer);
       DOMBuffer*                   popBuffer();
   
  
  
  
  1.12      +2 -2      xml-xerces/c/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp
  
  Index: DOMDocumentTypeImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DOMDocumentTypeImpl.cpp   16 Aug 2002 13:39:27 -0000      1.11
  +++ DOMDocumentTypeImpl.cpp   16 Aug 2002 16:02:53 -0000      1.12
  @@ -385,8 +385,8 @@
   {
       if (fNode.isOwned()) {
           if (fNode.isToBeReleased()) {
  +            // we are calling from documnet.release() which will notify the user 
data handler
               if (fIsCreatedFromHeap) {
  -                fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
                   DOMDocumentType* docType = this;
                   delete docType;
               }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to