lmi
[Top][All Lists]
Advanced

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

[lmi] Why does this crash?


From: Greg Chicares
Subject: [lmi] Why does this crash?
Date: Sat, 17 Apr 2010 14:03:57 +0000
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

I get a segfault, and my jit debugger says:

70F6669E  libxml2-2.dll:70F6669E  xmlNodeIsText  tree.c:6427
int xmlNodeIsText(
        xmlNodePtr node = &(indirect)
)
        ...
            if (node == NULL) return(0);
        
>           if (node->type == XML_TEXT_NODE) return(1);
            return(0);
        }

with the patch below (it's fine without). Shouldn't this principle:
  
http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/
apply here? I feel like I'm missing something obvious.

Index: xml_serializable.tpp
===================================================================
--- xml_serializable.tpp        (revision 4841)
+++ xml_serializable.tpp        (working copy)
@@ -228,8 +228,8 @@
     ,int                 file_version
     )
 {
-    xml::node::const_iterator i = xml_lmi::retrieve_element(parent, name);
-    std::string s = xml_lmi::get_content(*i);
+    xml::element const& e = *xml_lmi::retrieve_element(parent, name);
+    std::string s = xml_lmi::get_content(e);
     redintegrate_ex_ante(file_version, name, s);
     t[name] = s;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]