[commit] r2675 - trunk/GME/Parser

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Tue May 16 15:56:51 CDT 2017


Author: ksmyth
Date: Tue May 16 15:56:51 2017
New Revision: 2675

Log:
Serialize calls to xerces Init and Terminate

Modified:
   trunk/GME/Parser/MetaParser.cpp
   trunk/GME/Parser/MgaParser.cpp
   trunk/GME/Parser/MgaParserBC.cpp
   trunk/GME/Parser/MgaParserSC.cpp
   trunk/GME/Parser/StdAfx.cpp
   trunk/GME/Parser/StdAfx.h
   trunk/GME/Parser/Transcoder.cpp
   trunk/GME/Parser/Transcoder.h

Modified: trunk/GME/Parser/MetaParser.cpp
==============================================================================
--- trunk/GME/Parser/MetaParser.cpp	Thu May 11 16:35:08 2017	(r2674)
+++ trunk/GME/Parser/MetaParser.cpp	Tue May 16 15:56:51 2017	(r2675)
@@ -35,8 +35,6 @@
 		XMLPlatformUtilsTerminate_RAII term;
 		try
 		{
-			XMLPlatformUtils::Initialize();
-
 			foundconstraints = false;
 			explicitguid = false;
 			{

Modified: trunk/GME/Parser/MgaParser.cpp
==============================================================================
--- trunk/GME/Parser/MgaParser.cpp	Thu May 11 16:35:08 2017	(r2674)
+++ trunk/GME/Parser/MgaParser.cpp	Tue May 16 15:56:51 2017	(r2675)
@@ -78,8 +78,6 @@
 		XMLPlatformUtilsTerminate_RAII term;
 		try
 		{
-			XMLPlatformUtils::Initialize();
-
 			SAXParser parser;
 			parser.setValidationScheme(SAXParser::Val_Always);
 			parser.setDocumentHandler(this);
@@ -246,8 +244,6 @@
 		XMLPlatformUtilsTerminate_RAII term;
 		try
 		{
-			XMLPlatformUtils::Initialize();
-
 			SAXParser parser;
 			parser.setValidationScheme(SAXParser::Val_Always);
 			parser.setDocumentHandler(this);
@@ -380,8 +376,6 @@
 		XMLPlatformUtilsTerminate_RAII term;
 		try
 		{
-			XMLPlatformUtils::Initialize();
-
 			SAXParser parser;
 			parser.setValidationScheme(SAXParser::Val_Never);
 			parser.setDocumentHandler(this);
@@ -1884,8 +1878,6 @@
 		XMLPlatformUtilsTerminate_RAII term;
 		try
 		{
-			XMLPlatformUtils::Initialize();
-
 			SAXParser parser;
 			parser.setValidationScheme(SAXParser::Val_Never);
 			parser.setDocumentHandler(this);

Modified: trunk/GME/Parser/MgaParserBC.cpp
==============================================================================
--- trunk/GME/Parser/MgaParserBC.cpp	Thu May 11 16:35:08 2017	(r2674)
+++ trunk/GME/Parser/MgaParserBC.cpp	Tue May 16 15:56:51 2017	(r2675)
@@ -71,8 +71,6 @@
 		XMLPlatformUtilsTerminate_RAII term;
 		try
 		{
-			XMLPlatformUtils::Initialize();
-
 			SAXParser parser;
 			parser.setValidationScheme(SAXParser::Val_Always);
 			parser.setDocumentHandler(this);

Modified: trunk/GME/Parser/MgaParserSC.cpp
==============================================================================
--- trunk/GME/Parser/MgaParserSC.cpp	Thu May 11 16:35:08 2017	(r2674)
+++ trunk/GME/Parser/MgaParserSC.cpp	Tue May 16 15:56:51 2017	(r2675)
@@ -60,8 +60,6 @@
 		XMLPlatformUtilsTerminate_RAII term;
 		try
 		{
-			XMLPlatformUtils::Initialize();
-
 			SAXParser parser;
 			parser.setValidationScheme(SAXParser::Val_Always);
 			parser.setDocumentHandler(this);

Modified: trunk/GME/Parser/StdAfx.cpp
==============================================================================
--- trunk/GME/Parser/StdAfx.cpp	Thu May 11 16:35:08 2017	(r2674)
+++ trunk/GME/Parser/StdAfx.cpp	Tue May 16 15:56:51 2017	(r2675)
@@ -12,3 +12,26 @@
 #import "MgaUtilLib.tlb" implementation_only no_namespace raw_method_prefix("") high_method_prefix("__") no_registry
 
 _locale_t c_locale = _create_locale(LC_ALL, "C");
+
+struct _XMLPlatformUtilsCriticalSection {
+	CRITICAL_SECTION section;
+	_XMLPlatformUtilsCriticalSection() {
+		InitializeCriticalSection(&section);
+	};
+	~_XMLPlatformUtilsCriticalSection() {
+		DeleteCriticalSection(&section);
+	}
+} XMLPlatformUtilsCriticalSection;
+
+#include <xercesc/util/PlatformUtils.hpp>
+XMLPlatformUtilsTerminate_RAII::XMLPlatformUtilsTerminate_RAII() {
+	EnterCriticalSection(&XMLPlatformUtilsCriticalSection.section);
+	xercesc_3_1::XMLPlatformUtils::Initialize();
+	LeaveCriticalSection(&XMLPlatformUtilsCriticalSection.section);
+}
+
+XMLPlatformUtilsTerminate_RAII::~XMLPlatformUtilsTerminate_RAII() {
+	EnterCriticalSection(&XMLPlatformUtilsCriticalSection.section);
+	xercesc_3_1::XMLPlatformUtils::Terminate();
+	LeaveCriticalSection(&XMLPlatformUtilsCriticalSection.section);
+}

Modified: trunk/GME/Parser/StdAfx.h
==============================================================================
--- trunk/GME/Parser/StdAfx.h	Thu May 11 16:35:08 2017	(r2674)
+++ trunk/GME/Parser/StdAfx.h	Tue May 16 15:56:51 2017	(r2675)
@@ -97,10 +97,10 @@
 	return _bstr_t(str.c_str());
 }
 
-#include <xercesc/util/PlatformUtils.hpp>
 class XMLPlatformUtilsTerminate_RAII {
 public:
-	~XMLPlatformUtilsTerminate_RAII() { xercesc_3_1::XMLPlatformUtils::Terminate(); }
+	XMLPlatformUtilsTerminate_RAII();
+	~XMLPlatformUtilsTerminate_RAII();
 };
 
 template <const IID* piid1, const IID* piid2>

Modified: trunk/GME/Parser/Transcoder.cpp
==============================================================================
--- trunk/GME/Parser/Transcoder.cpp	Thu May 11 16:35:08 2017	(r2674)
+++ trunk/GME/Parser/Transcoder.cpp	Tue May 16 15:56:51 2017	(r2675)
@@ -46,8 +46,6 @@
 {
 	ASSERT( !m_pFormatter);
 
-	XMLPlatformUtils::Initialize();
-	
 	m_pFormatter = new XMLFormatter
     (
         encodingName
@@ -78,8 +76,6 @@
 	m_pFormatter = 0;
 
 	close();
-
-	XMLPlatformUtils::Terminate();
 }
 
 

Modified: trunk/GME/Parser/Transcoder.h
==============================================================================
--- trunk/GME/Parser/Transcoder.h	Thu May 11 16:35:08 2017	(r2674)
+++ trunk/GME/Parser/Transcoder.h	Tue May 16 15:56:51 2017	(r2675)
@@ -37,6 +37,7 @@
 
 private :
     XMLFormatter* m_pFormatter;
+	XMLPlatformUtilsTerminate_RAII xercesInit;
 };
 
 


More information about the gme-commit mailing list