[libxml2] * parser.c threads.c: change the threading initialization sequence



commit 7dd7080ad70c59ab21514b741a47128eb424dd35
Author: Daniel Veillard <veillard redhat com>
Date:   Thu Jun 4 11:08:39 2009 +0200

    * parser.c threads.c: change the threading initialization sequence
      as suggested by Igor Novoseltsev to avoid crash if xmlInitParser()
      is called from a thread which is not the main one, should fix
      #584605
    daniel
---
 ChangeLog |    7 +++++++
 parser.c  |    4 ++--
 threads.c |    3 ---
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ed6fc5d..601b000 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Thu Jun  4 11:06:07 CEST 2009 Daniel Veillard <daniel veillard com>
+
+	* parser.c threads.c: change the threading initialization sequence
+	  as suggested by Igor Novoseltsev to avoid crash if xmlInitParser()
+	  is called from a thread which is not the main one, should fix
+	  #584605
+
 Fri May 15 17:54:48 CEST 2009 Daniel Veillard <daniel veillard com>
 
 	* HTMLparser.c: make sure we keep line numbers fixes #580705
diff --git a/parser.c b/parser.c
index 5b04cf5..dea5650 100644
--- a/parser.c
+++ b/parser.c
@@ -13847,11 +13847,11 @@ xmlInitParser(void) {
     __xmlGlobalInitMutexLock();
     if (xmlParserInitialized == 0) {
 #endif
+	xmlInitGlobals();
+	xmlInitThreads();
 	if ((xmlGenericError == xmlGenericErrorDefaultFunc) ||
 	    (xmlGenericError == NULL))
 	    initGenericErrorDefaultFunc(NULL);
-	xmlInitGlobals();
-	xmlInitThreads();
 	xmlInitMemory();
 	xmlInitCharEncodingHandlers();
 	xmlDefaultSAXHandlerInit();
diff --git a/threads.c b/threads.c
index 073fd14..25e2790 100644
--- a/threads.c
+++ b/threads.c
@@ -852,9 +852,6 @@ xmlUnlockLibrary(void)
 void
 xmlInitThreads(void)
 {
-#ifdef DEBUG_THREADS
-    xmlGenericError(xmlGenericErrorContext, "xmlInitThreads()\n");
-#endif
 #if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
     InitializeCriticalSection(&cleanup_helpers_cs);
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]