summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-10-07 18:22:53 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-10-07 18:22:53 (GMT)
commiteb982771caed944f441967194df86ddbec21efde (patch)
treee76ab6fccb3e88898d9bb1eb4c8866d6ebdcbb5d /Swiften/Parser/LibXMLParser.cpp
parent6b98253a4127c975bd59b6a49ddb203337a8c32b (diff)
downloadswift-contrib-eb982771caed944f441967194df86ddbec21efde.zip
swift-contrib-eb982771caed944f441967194df86ddbec21efde.tar.bz2
Initialize LibXML for multithreaded applications.
Diffstat (limited to 'Swiften/Parser/LibXMLParser.cpp')
-rw-r--r--Swiften/Parser/LibXMLParser.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Swiften/Parser/LibXMLParser.cpp b/Swiften/Parser/LibXMLParser.cpp
index ae87f38..1590262 100644
--- a/Swiften/Parser/LibXMLParser.cpp
+++ b/Swiften/Parser/LibXMLParser.cpp
@@ -51,9 +51,15 @@ static void handleError(void*, const char* /*m*/, ... ) {
static void handleWarning(void*, const char*, ... ) {
}
-
+bool LibXMLParser::initialized = false;
LibXMLParser::LibXMLParser(XMLParserClient* client) : XMLParser(client) {
+ // Initialize libXML for multithreaded applications
+ if (!initialized) {
+ xmlInitParser();
+ initialized = true;
+ }
+
memset(&handler_, 0, sizeof(handler_) );
handler_.initialized = XML_SAX2_MAGIC;
handler_.startElementNs = &handleStartElement;