Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix (attr) iterators to return references to real objects, not temporary proxies #15

Open
vslavik opened this issue Jun 27, 2013 · 0 comments

Comments

@vslavik
Copy link
Owner

vslavik commented Jun 27, 2013

Attributes iterators, in particular, return a reference to an internal attr object owned by the iterator. This means that the reference is only valid for the lifetime of the iterator and code like this is invalid:

xml::attributes::attr& a = *(root.get_attributes().begin());
// iterator freed, including its attr object, 'a' no longer valid
a.set_namespace(xml::namespaces::ns("href2", "p2"));

This is extremely unexpected for a C++ programmer.

vslavik added a commit that referenced this issue Jun 28, 2013
Errors detected by Valgrind were mostly access to already freed memory.
Admittedly, these are mostly weirdness in xmlwrapp itself (see issue
#15).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant