Commit 2f57360b authored by Michael Catanzaro's avatar Michael Catanzaro Committed by Shaun McCance

mallard-document: fix crash when reloading document

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.)
parent 31f5dc15
......@@ -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;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment