mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Record detached document of a node and use that to fix memory leak.
This commit is contained in:
parent
3f27cb0d23
commit
0d010003f9
3 changed files with 40 additions and 18 deletions
|
@ -183,7 +183,12 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
self = [self initWithKind: NSXMLDocumentKind options: 0];
|
||||
if (self != nil)
|
||||
{
|
||||
[self setRootElement: (NSXMLNode*)element];
|
||||
NS_DURING
|
||||
[self setRootElement: (NSXMLNode*)element];
|
||||
NS_HANDLER
|
||||
RELEASE(self);
|
||||
[localException raise];
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -279,6 +284,11 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
// FIXME: Should we use addChild: here?
|
||||
xmlDocSetRootElement(internal->node.doc, [root _node]);
|
||||
if (root->detached)
|
||||
{
|
||||
xmlFreeDoc(root->detached);
|
||||
root->detached = 0;
|
||||
}
|
||||
|
||||
// Do our subNode housekeeping...
|
||||
[self _addSubNode: root];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue