| Index: third_party/libxml/globals.c
 | 
| diff --git a/third_party/libxml/globals.c b/third_party/libxml/globals.c
 | 
| index cbc66253d14c05d61d4ba8dbbe1af11383cae00b..69002f007d0e6f2673a0454438262497fa9f5fb2 100644
 | 
| --- a/third_party/libxml/globals.c
 | 
| +++ b/third_party/libxml/globals.c
 | 
| @@ -46,7 +46,8 @@ static xmlMutexPtr xmlThrDefMutex = NULL;
 | 
|   */
 | 
|  void xmlInitGlobals(void)
 | 
|  {
 | 
| -    xmlThrDefMutex = xmlNewMutex();
 | 
| +    if (xmlThrDefMutex == NULL)
 | 
| +        xmlThrDefMutex = xmlNewMutex();
 | 
|  }
 | 
|  
 | 
|  /**
 | 
| @@ -148,6 +149,7 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
 | 
|  #undef	xmlGenericError
 | 
|  #undef	xmlStructuredError
 | 
|  #undef	xmlGenericErrorContext
 | 
| +#undef	xmlStructuredErrorContext
 | 
|  #undef	xmlGetWarningsDefaultValue
 | 
|  #undef	xmlIndentTreeOutput
 | 
|  #undef  xmlTreeIndentString
 | 
| @@ -314,6 +316,13 @@ static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
 | 
|   */
 | 
|  void *xmlGenericErrorContext = NULL;
 | 
|  static void *xmlGenericErrorContextThrDef = NULL;
 | 
| +/**
 | 
| + * xmlStructuredErrorContext:
 | 
| + *
 | 
| + * Global setting passed to structured error callbacks
 | 
| + */
 | 
| +void *xmlStructuredErrorContext = NULL;
 | 
| +static void *xmlStructuredErrorContextThrDef = NULL;
 | 
|  xmlError xmlLastError;
 | 
|  
 | 
|  /*
 | 
| @@ -545,6 +554,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
 | 
|      gs->xmlGenericError = xmlGenericErrorThrDef;
 | 
|      gs->xmlStructuredError = xmlStructuredErrorThrDef;
 | 
|      gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
 | 
| +    gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
 | 
|      gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
 | 
|      gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
 | 
|  
 | 
| @@ -573,7 +583,7 @@ xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
 | 
|  void
 | 
|  xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
 | 
|      xmlMutexLock(xmlThrDefMutex);
 | 
| -    xmlGenericErrorContextThrDef = ctx;
 | 
| +    xmlStructuredErrorContextThrDef = ctx;
 | 
|      xmlStructuredErrorThrDef = handler;
 | 
|      xmlMutexUnlock(xmlThrDefMutex);
 | 
|  }
 | 
| @@ -876,6 +886,15 @@ __xmlGenericErrorContext(void) {
 | 
|  	return (&xmlGetGlobalState()->xmlGenericErrorContext);
 | 
|  }
 | 
|  
 | 
| +#undef	xmlStructuredErrorContext
 | 
| +void * *
 | 
| +__xmlStructuredErrorContext(void) {
 | 
| +    if (IS_MAIN_THREAD)
 | 
| +	return (&xmlStructuredErrorContext);
 | 
| +    else
 | 
| +	return (&xmlGetGlobalState()->xmlStructuredErrorContext);
 | 
| +}
 | 
| +
 | 
|  #undef	xmlGetWarningsDefaultValue
 | 
|  int *
 | 
|  __xmlGetWarningsDefaultValue(void) {
 | 
| @@ -910,7 +929,7 @@ int xmlThrDefIndentTreeOutput(int v) {
 | 
|      return ret;
 | 
|  }
 | 
|  
 | 
| -#undef xmlTreeIndentString
 | 
| +#undef	xmlTreeIndentString
 | 
|  const char * *
 | 
|  __xmlTreeIndentString(void) {
 | 
|      if (IS_MAIN_THREAD)
 | 
| 
 |