summaryrefslogtreecommitdiff
path: root/utils/regtools/lib/soc_desc.cpp
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-09-16 12:13:42 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2014-09-16 12:16:55 +0200
commit8855ce5a79dc43c7751c419c0f8af37f445ab9d8 (patch)
tree709669a8f54d790ebd9c2a48ec816c2900c95b9c /utils/regtools/lib/soc_desc.cpp
parentc1bbaf4050c25f323ab6c37492608de8ecb66968 (diff)
downloadrockbox-8855ce5a79dc43c7751c419c0f8af37f445ab9d8.tar.gz
rockbox-8855ce5a79dc43c7751c419c0f8af37f445ab9d8.zip
regtools/soc_desc: fix libxml2 misinit
The code did not call xmlInitParser() and would call xmlCleanupParser() each time which is doubly wrong because 1) it's not init 2) all init/cleanup must be done from the main thread. To ensure 2), call it from a static ctor. Change-Id: I3d191bf3b8c0cfc51da78157e88c786636fd3ebf Reviewed-on: http://gerrit.rockbox.org/966 Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
Diffstat (limited to 'utils/regtools/lib/soc_desc.cpp')
-rw-r--r--utils/regtools/lib/soc_desc.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/utils/regtools/lib/soc_desc.cpp b/utils/regtools/lib/soc_desc.cpp
index 1c9eaf7972..3904f6a77e 100644
--- a/utils/regtools/lib/soc_desc.cpp
+++ b/utils/regtools/lib/soc_desc.cpp
@@ -293,7 +293,6 @@ bool soc_desc_parse_xml(const std::string& filename, soc_t& socs)
293 bool ret = parse_root_elem(root_element, socs); 293 bool ret = parse_root_elem(root_element, socs);
294 294
295 xmlFreeDoc(doc); 295 xmlFreeDoc(doc);
296 xmlCleanupParser();
297 296
298 return ret; 297 return ret;
299} 298}
@@ -967,3 +966,20 @@ bool soc_desc_evaluate_formula(const std::string& formula,
967 my_evaluator e(formula, var); 966 my_evaluator e(formula, var);
968 return e.parse(result, error); 967 return e.parse(result, error);
969} 968}
969
970/** WARNING we need to call xmlInitParser() to init libxml2 but it needs to
971 * called from the main thread, which is a super strong requirement, so do it
972 * using a static constructor */
973namespace
974{
975class xml_parser_init
976{
977public:
978 xml_parser_init()
979 {
980 xmlInitParser();
981 }
982};
983
984xml_parser_init __xml_parser_init;
985}