* 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
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 @@
     __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 @@
 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