From d7aa09fec3c9560edf218b5d0c3badd9d2db5972 Mon Sep 17 00:00:00 2001 From: Manuel Reimer Date: Wed, 12 Nov 2014 16:58:01 +0100 Subject: [PATCH] Init/Cleanup libxml only once at VDR start/end. Copied from xmltv2vdr plugin. --- libtemplate/xmlparser.c | 10 ++++++++-- libtemplate/xmlparser.h | 4 +++- skindesigner.c | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libtemplate/xmlparser.c b/libtemplate/xmlparser.c index 0e2c132..23912b7 100644 --- a/libtemplate/xmlparser.c +++ b/libtemplate/xmlparser.c @@ -12,7 +12,6 @@ cXmlParser::cXmlParser(void) { root = NULL; ctxt = NULL; - xmlInitParser(); initGenericErrorDefaultFunc(NULL); xmlSetStructuredErrorFunc(NULL, SkinDesignerXMLErrorHandler); ctxt = xmlNewParserCtxt(); @@ -21,7 +20,6 @@ cXmlParser::cXmlParser(void) { cXmlParser::~cXmlParser() { DeleteDocument(); xmlFreeParserCtxt(ctxt); - xmlCleanupParser(); } /********************************************************************* @@ -737,3 +735,11 @@ bool cXmlParser::DebugViewElement(xmlNodePtr node) { } return false; } + +void cXmlParser::InitLibXML() { + xmlInitParser(); +} + +void cXmlParser::CleanupLibXML() { + xmlCleanupParser(); +} diff --git a/libtemplate/xmlparser.h b/libtemplate/xmlparser.h index ecdcca3..cba1eb4 100644 --- a/libtemplate/xmlparser.h +++ b/libtemplate/xmlparser.h @@ -51,6 +51,8 @@ public: bool ParseView(void); bool ParseGlobals(void); void DeleteDocument(void); + static void InitLibXML(); + static void CleanupLibXML(); }; -#endif //__XMLPARSER_H \ No newline at end of file +#endif //__XMLPARSER_H diff --git a/skindesigner.c b/skindesigner.c index c2f499a..e6955f6 100644 --- a/skindesigner.c +++ b/skindesigner.c @@ -95,6 +95,7 @@ bool cPluginSkinDesigner::Initialize(void) { } bool cPluginSkinDesigner::Start(void) { + cXmlParser::InitLibXML(); bool trueColorAvailable = true; if (!cOsdProvider::SupportsTrueColor()) { esyslog("skindesigner: No TrueColor OSD found! Using default Skin LCARS!"); @@ -121,6 +122,7 @@ bool cPluginSkinDesigner::Start(void) { void cPluginSkinDesigner::Stop(void) { delete imgCache; delete fontManager; + cXmlParser::CleanupLibXML(); } void cPluginSkinDesigner::Housekeeping(void) {