summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2020-10-29 14:21:19 -0500
committerMichael Catanzaro <mcatanzaro@gnome.org>2020-10-29 14:21:19 -0500
commit226fc1abcb0485bac53e2c3f6366b74caa4571d3 (patch)
treeee8cf2d6382e7633b65a44384c34a25990860f40
parent12122c54619d1c3757dfaedff3812f151262a9f7 (diff)
downloadyelp-226fc1abcb0485bac53e2c3f6366b74caa4571d3.tar.gz
mallard-document: fix crash when reloading documentmcatanzaro/#122
libxml memory management is quite uncleary, but I believe priv->cache has ownership of priv->mallard_ns, so the later is invalidated when the former is freed. We need to recreate it here. Reportedly fixes #122 for Shaun. (I was still seeing another crash, but it's probably a separate issue.)
-rw-r--r--libyelp/yelp-mallard-document.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libyelp/yelp-mallard-document.c b/libyelp/yelp-mallard-document.c
index f417a361..6a5b643c 100644
--- a/libyelp/yelp-mallard-document.c
+++ b/libyelp/yelp-mallard-document.c
@@ -1168,6 +1168,7 @@ mallard_monitor_changed (GFileMonitor *monitor,
xmlFreeDoc (priv->cache);
priv->cache = xmlNewDoc (BAD_CAST "1.0");
priv->cache_ns = xmlNewNs (NULL, CACHE_NS, BAD_CAST "cache");
+ priv->mallard_ns = xmlNewNs (NULL, MALLARD_NS, BAD_CAST "mal");
cur = xmlNewDocNode (priv->cache, priv->cache_ns, BAD_CAST "cache", NULL);
xmlDocSetRootElement (priv->cache, cur);
priv->cache_ns->next = priv->mallard_ns;