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/25 01:46:53 UTC
cvs commit: xml-xerces/c/src/framework XMLValidator.cpp XMLValidator.hpp
peiyongz 01/10/24 16:46:52
Modified: c/src/framework XMLValidator.cpp XMLValidator.hpp
Log:
[Bug 4342] fix the leak.
Revision Changes Path
1.11 +24 -2 xml-xerces/c/src/framework/XMLValidator.cpp
Index: XMLValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/framework/XMLValidator.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XMLValidator.cpp 2001/06/04 21:07:34 1.10
+++ XMLValidator.cpp 2001/10/24 23:46:52 1.11
@@ -56,6 +56,9 @@
/**
* $Log: XMLValidator.cpp,v $
+ * Revision 1.11 2001/10/24 23:46:52 peiyongz
+ * [Bug 4342] fix the leak.
+ *
* Revision 1.10 2001/06/04 21:07:34 jberry
* Increment scanner error count from schema validator, not just in scanner itself.
*
@@ -107,23 +110,25 @@
#include <util/PlatformUtils.hpp>
#include <util/XMLMsgLoader.hpp>
#include <util/XMLString.hpp>
+#include <util/XMLRegisterCleanup.hpp>
#include <framework/XMLErrorReporter.hpp>
#include <framework/XMLValidator.hpp>
#include <internal/XMLScanner.hpp>
-
// ---------------------------------------------------------------------------
// Local static functions
// ---------------------------------------------------------------------------
+static XMLMutex* validatorMutex = 0;
+static XMLRegisterCleanup validatorMutexCleanup;
+
//
// We need to fault in this mutex. But, since its used for synchronization
// itself, we have to do this the low level way using a compare and swap.
//
static XMLMutex& gValidatorMutex()
{
- static XMLMutex* validatorMutex = 0;
if (!validatorMutex)
{
XMLMutex* tmpMutex = new XMLMutex;
@@ -132,7 +137,12 @@
// Someone beat us to it, so let's clean up ours
delete tmpMutex;
}
+ else
+ {
+ validatorMutexCleanup.registerCleanup(XMLValidator::reinitXMLValidator);
+ }
}
+
return *validatorMutex;
}
@@ -349,3 +359,15 @@
, fScanner(0)
{
}
+
+// -----------------------------------------------------------------------
+// Notification that lazy data has been deleted
+// -----------------------------------------------------------------------
+void XMLValidator::reinitXMLValidator() {
+
+ delete validatorMutex;
+ validatorMutex = 0;
+
+}
+
+
1.15 +7 -0 xml-xerces/c/src/framework/XMLValidator.hpp
Index: XMLValidator.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/framework/XMLValidator.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- XMLValidator.hpp 2001/06/05 16:51:17 1.14
+++ XMLValidator.hpp 2001/10/24 23:46:52 1.15
@@ -56,6 +56,9 @@
/*
* $Log: XMLValidator.hpp,v $
+ * Revision 1.15 2001/10/24 23:46:52 peiyongz
+ * [Bug 4342] fix the leak.
+ *
* Revision 1.14 2001/06/05 16:51:17 knoaman
* Add 'const' to getGrammar - submitted by Peter A. Volchek.
*
@@ -408,6 +411,10 @@
//@}
+ // -----------------------------------------------------------------------
+ // Notification that lazy data has been deleted
+ // -----------------------------------------------------------------------
+ static void reinitXMLValidator();
protected :
// -----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org