gnustep-dev
[Top][All Lists]
Advanced

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

Re: Unresolved Issues with libxml2


From: Fred Kiefer
Subject: Re: Unresolved Issues with libxml2
Date: Wed, 04 Apr 2012 23:38:17 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120312 Thunderbird/11.0

Hi Doug,

thank you for providing this test code. I could reproduce the problem
and have committed a simplified version of your test code to SVN. Plus a
solution to the problem.
It turned out to be caused by the private document I use to hold
detached nodes. This together with the code that allows the document to
provide replacement classes for node types could lead to a segmentation
fault. I fixed this by not allowing the private document to be
considered in class replacements. Please test again with SVN code.

If you are interested in a solution to your issue #1, please provide some test code that shows this behaviour.

Cheers,
Fred

On 04.04.2012 00:56, Doug Simons wrote:
Hello Fred,

Thanks for all of your work on the XML classes, and for your summary
of the areas that still need attention. My original issue #1 (at the
beginning of this thread) is still outstanding as well. My issues #2
and #3 have been resolved -- thanks!

As it happens, I managed to get back to this yesterday, and spent
most of yesterday and today trying to isolate the memory crash I was
seeing. It turns out there were (unfortunately) a lot of red herrings
in my earlier description of the sequence that leads to the crash,
and obviously some missing steps or you would have been able to
reproduce it. I was finally able to reproduce the crash myself and
create a minimal test case for this problem.

Unfortunately, I've now spent too much time on this to do much more
with it. I appreciate that you've spent a lot of time on this code,
too, but I hope you might be able to figure out how to resolve this
problem. If not, we will revert to a slightly earlier version of the
NSXML* code for now, which doesn't crash in this way.

Regards,

Doug

Here is my crashTest:

#import "ObjectTesting.h" #import<Foundation/NSAutoreleasePool.h>
#import<Foundation/NSXMLDocument.h>
#import<Foundation/NSXMLElement.h>

int main() { NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSXMLDocument *node; NSXMLDocument *node2; NSXMLElement *elem;
NSXMLElement *elem2; NSXMLNode *child; NSXMLNode *child2;

NSString *simpleXML = @"<num>6</num>";

// create two documents (containing root elements with the same name
("num") -- may be significant?) node = [[NSXMLDocument alloc]
initWithXMLString:simpleXML options:0 error:NULL]; PASS(node != nil,
"document was initialized from a string");

node2 = [[NSXMLDocument alloc] initWithXMLString:simpleXML options:0
error:NULL]; PASS(node2 != nil, "document 2 was initialized from a
string");

// detach the root elements from their documents elem = [node
rootElement]; //  PASS_EQUAL([elem XMLString], simpleXML, "root
element is correct"); [elem detach];

elem2 = [node2 rootElement]; //  PASS_EQUAL([elem2 XMLString],
simpleXML, "root element 2 is correct"); [elem2 detach];

// now, simply accessing the text node child of each element leads to
a CRASH child = [elem childAtIndex:0]; child2 = [elem2
childAtIndex:0];

[node release]; [node2 release];

[arp release]; arp = nil;

return 0; }




reply via email to

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