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();
|
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 *
|
* All the user accessible global variables of the library *
|
||||||
@@ -1122,3 +1108,19 @@ __xmlOutputBufferCreateFilenameValue(void) {
|
|||||||
return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
|
return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlCleanupGlobals:
|
||||||
|
*
|
||||||
|
* Additional cleanup for multi-threading
|
||||||
|
*/
|
||||||
|
void xmlCleanupGlobals(void)
|
||||||
|
{
|
||||||
|
xmlResetError(&xmlLastError);
|
||||||
|
|
||||||
|
if (xmlThrDefMutex != NULL) {
|
||||||
|
xmlFreeMutex(xmlThrDefMutex);
|
||||||
|
xmlThrDefMutex = NULL;
|
||||||
|
}
|
||||||
|
__xmlGlobalInitMutexDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
1
parser.c
1
parser.c
@@ -14753,7 +14753,6 @@ xmlCleanupParser(void) {
|
|||||||
xmlSchemaCleanupTypes();
|
xmlSchemaCleanupTypes();
|
||||||
xmlRelaxNGCleanupTypes();
|
xmlRelaxNGCleanupTypes();
|
||||||
#endif
|
#endif
|
||||||
xmlResetLastError();
|
|
||||||
xmlCleanupGlobals();
|
xmlCleanupGlobals();
|
||||||
xmlCleanupThreads(); /* must be last if called not from the main thread */
|
xmlCleanupThreads(); /* must be last if called not from the main thread */
|
||||||
xmlCleanupMemory();
|
xmlCleanupMemory();
|
||||||
|
|||||||
Reference in New Issue
Block a user