You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by pe...@apache.org on 2001/10/24 01:04:38 UTC

cvs commit: xml-xerces/c/src/dom DOM_DOMImplementation.cpp

peiyongz    01/10/23 16:04:38

  Modified:    c/src/dom DOM_DOMImplementation.cpp
  Log:
  [Bug#880] patch to PlatformUtils:init()/term() and related. from Mark Weaver
  
  Revision  Changes    Path
  1.10      +18 -7     xml-xerces/c/src/dom/DOM_DOMImplementation.cpp
  
  Index: DOM_DOMImplementation.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_DOMImplementation.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DOM_DOMImplementation.cpp	2000/05/09 00:22:31	1.9
  +++ DOM_DOMImplementation.cpp	2001/10/23 23:04:38	1.10
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: DOM_DOMImplementation.cpp,v $
  + * Revision 1.10  2001/10/23 23:04:38  peiyongz
  + * [Bug#880] patch to PlatformUtils:init()/term() and related. from Mark Weaver
  + *
    * Revision 1.9  2000/05/09 00:22:31  andyh
    * Memory Cleanup.  XMLPlatformUtils::Terminate() deletes all lazily
    * allocated memory; memory leak checking tools will no longer report
  @@ -121,14 +124,15 @@
   #include "DocumentImpl.hpp"
   #include "DocumentTypeImpl.hpp"
   #include "DStringPool.hpp"
  -#include <util/XMLDeleterFor.hpp>
   #include <util/PlatformUtils.hpp>
  +#include <util/XMLRegisterCleanup.hpp>
   
   //
   //  Static constants.  These are lazily initialized on first usage.
   //                     (Static constructors can not be safely used because
   //                      of order of initialization dependencies.)
   
  +
   static DOM_DOMImplementation    *gDomimp;   // Points to the singleton instance
                                               //  of DOMImplementation that is returned
                                               //  by any call to getImplementation().
  @@ -167,6 +171,13 @@
       return *this;
   };
   
  +// -----------------------------------------------------------------------
  +//  Reset the singleton DOM_DOMImplementation
  +// -----------------------------------------------------------------------
  +static void reinitImplementation() {
  +	delete gDomimp;
  +	gDomimp = 0;
  +}
   
   //  getImplementation()  - Always returns the same singleton instance, which
   //                         is lazily created on the first call.  Note that
  @@ -177,6 +188,8 @@
   //                         used concurrently by different threads.
   //
   DOM_DOMImplementation &DOM_DOMImplementation::getImplementation() {
  +	static XMLRegisterCleanup implementationCleanup;
  +
       if (gDomimp == 0)
       {
           DOM_DOMImplementation *t = new DOM_DOMImplementation;
  @@ -186,17 +199,12 @@
           }
           else
           {
  -            
  -            XMLPlatformUtils::registerLazyData
  -                (
  -                new XMLDeleterFor<DOM_DOMImplementation>(gDomimp)
  -                );
  +			implementationCleanup.registerCleanup(reinitImplementation);
           }
           
       }
       return *gDomimp;
   };
  -
   
   bool  DOM_DOMImplementation::hasFeature(const DOMString &feature,  const DOMString &version) 
   {
  
  
  

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