mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-28 23:14:57 +03:00
Reset last error in xmlCleanupGlobals
Before, we tried to reset the last error in xmlCleanupParser. But if xmlCleanupParser wasn't called from the main thread, this would reset the thread-local error object. xmlCleanupGlobals has access to the error object of the main thread and can reset it reliably.
This commit is contained in:
30
globals.c
30
globals.c
@@ -50,20 +50,6 @@ void xmlInitGlobals(void)
|
||||
xmlThrDefMutex = xmlNewMutex();
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlCleanupGlobals:
|
||||
*
|
||||
* Additional cleanup for multi-threading
|
||||
*/
|
||||
void xmlCleanupGlobals(void)
|
||||
{
|
||||
if (xmlThrDefMutex != NULL) {
|
||||
xmlFreeMutex(xmlThrDefMutex);
|
||||
xmlThrDefMutex = NULL;
|
||||
}
|
||||
__xmlGlobalInitMutexDestroy();
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* All the user accessible global variables of the library *
|
||||
@@ -1122,3 +1108,19 @@ __xmlOutputBufferCreateFilenameValue(void) {
|
||||
return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlCleanupGlobals:
|
||||
*
|
||||
* Additional cleanup for multi-threading
|
||||
*/
|
||||
void xmlCleanupGlobals(void)
|
||||
{
|
||||
xmlResetError(&xmlLastError);
|
||||
|
||||
if (xmlThrDefMutex != NULL) {
|
||||
xmlFreeMutex(xmlThrDefMutex);
|
||||
xmlThrDefMutex = NULL;
|
||||
}
|
||||
__xmlGlobalInitMutexDestroy();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user