[gxml] Fixed sigfault on Attributes xElement. Fixed HtmlDocument test



commit 2ec1ac27e487dede457b82f64f74c549f92689bb
Author: Daniel Espinosa <esodan gmail com>
Date:   Thu Feb 4 19:21:29 2016 -0600

    Fixed sigfault on Attributes xElement. Fixed HtmlDocument test

 gxml/libxml-BackedNode.vala    |    1 +
 gxml/libxml-ChildNodeList.vala |    1 +
 gxml/libxml-Element.vala       |    1 +
 gxml/libxml-NamedAttrMap.vala  |    5 +++++
 4 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gxml/libxml-BackedNode.vala b/gxml/libxml-BackedNode.vala
index 67eeb84..14edff6 100644
--- a/gxml/libxml-BackedNode.vala
+++ b/gxml/libxml-BackedNode.vala
@@ -52,6 +52,7 @@ namespace GXml {
                        this.set_xmlnode (node, owner);
                        // TODO: Consider checking whether the Xml.Node* is already recorded.  It shouldn't 
be.
                        // TODO: BackedNodes' memory are freed when their owner document is freed; let's make 
sure that when we move a node between documents, that we make sure they'll still be freed
+                       Test.message ("Getting NodeChildNodeList for node: "+name);
                        _child_nodes = new NodeChildNodeList (this.node, this.owner_document);
                }
 
diff --git a/gxml/libxml-ChildNodeList.vala b/gxml/libxml-ChildNodeList.vala
index 1f4bb94..305693b 100644
--- a/gxml/libxml-ChildNodeList.vala
+++ b/gxml/libxml-ChildNodeList.vala
@@ -80,6 +80,7 @@ internal abstract class GXml.ChildNodeList : AbstractBidirList<xNode>, NodeList
                public override new xNode @get (int n)
             requires (head != null)
         {
+          Test.message ("Searching for node at: "+n.to_string ());
             Xml.Node *cur = head;
             int i = 0;
             while (cur != null) {
diff --git a/gxml/libxml-Element.vala b/gxml/libxml-Element.vala
index ed18fe4..f48a9b1 100644
--- a/gxml/libxml-Element.vala
+++ b/gxml/libxml-Element.vala
@@ -95,6 +95,7 @@ namespace GXml {
                                if (this._attributes == null) {
                                        this._attributes = new NamedAttrMap (this);
                                }
+                               Test.message ("Getting Attributes NamedAttrMap");
                                return (NamedAttrMap) this._attributes;
                        }
                        internal set {
diff --git a/gxml/libxml-NamedAttrMap.vala b/gxml/libxml-NamedAttrMap.vala
index 9ac0276..04a418a 100644
--- a/gxml/libxml-NamedAttrMap.vala
+++ b/gxml/libxml-NamedAttrMap.vala
@@ -146,8 +146,13 @@ namespace GXml {
                public bool contains (string key) { return has_key (key); }
                public bool contains_all (Gee.Map<string,GXml.Attribute> map) { return has_all (map); }
                public new Attribute @get (string key)
+                       requires (elem != null)
+                       requires (elem.node != null)
                {
+                       Test.message ("Getting from libxml2 an attribute node");
                        var at = elem.node->has_prop (key);
+                       if (at == null) return null;
+                       Test.message ("Creating attribute with libxml2 node");
                        return (Attribute) new xAttr(at, (xDocument) elem.document);
                }
                public bool has (string key, Attribute value)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]