mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
2012-02-27 Fred Kiefer <FredKiefer@gmx.de>
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34828 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4b79143129
commit
6e4e57e690
2 changed files with 15 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2012-02-27 Doug Simons <doug.simons@testplant.com>
|
||||||
|
Merged to trunk by: greg.casamento@gmail.com
|
||||||
|
|
||||||
|
* Source/NSXMLDocument.m: Fix bugs in setCharacterEncoding: and
|
||||||
|
copyWithZone: that cause a memory crash when tree is freed.
|
||||||
|
Doug Simons <doug.simons@testplant.com>
|
||||||
|
|
||||||
2012-02-27 Fred Kiefer <FredKiefer@gmx.de>
|
2012-02-27 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSXMLNode.m (+_objectForNode:): Get the actual class from
|
* Source/NSXMLNode.m (+_objectForNode:): Get the actual class from
|
||||||
|
|
|
@ -53,6 +53,7 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
||||||
- (void) _addSubNode:(NSXMLNode *)subNode;
|
- (void) _addSubNode:(NSXMLNode *)subNode;
|
||||||
- (void) _removeSubNode:(NSXMLNode *)subNode;
|
- (void) _removeSubNode:(NSXMLNode *)subNode;
|
||||||
- (void) _insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index;
|
- (void) _insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index;
|
||||||
|
- (id) _initWithNode:(xmlNodePtr)node kind:(NSXMLNodeKind)kind;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSXMLDocument
|
@implementation NSXMLDocument
|
||||||
|
@ -228,7 +229,7 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
||||||
|
|
||||||
- (void) setCharacterEncoding: (NSString*)encoding
|
- (void) setCharacterEncoding: (NSString*)encoding
|
||||||
{
|
{
|
||||||
MY_DOC->encoding = XMLSTRING(encoding);
|
MY_DOC->encoding = xmlStrdup(XMLSTRING(encoding));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setDocumentContentKind: (NSXMLDocumentContentKind)kind
|
- (void) setDocumentContentKind: (NSXMLDocumentContentKind)kind
|
||||||
|
@ -474,10 +475,12 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
||||||
|
|
||||||
- (id) copyWithZone: (NSZone *)zone
|
- (id) copyWithZone: (NSZone *)zone
|
||||||
{
|
{
|
||||||
NSXMLDocument *c = (NSXMLDocument*)[super copyWithZone: zone];
|
id c = [[self class] allocWithZone: zone];
|
||||||
internal->node = (xmlDoc *)xmlCopyDoc(MY_DOC, 1); // copy recursively
|
xmlDocPtr newNode = xmlCopyDoc(MY_DOC, 1); // make a deep copy
|
||||||
clearPrivatePointers(internal->node); // clear out all of the _private pointers in the entire tree
|
clearPrivatePointers((xmlNodePtr)newNode);
|
||||||
((xmlNodePtr)internal->node)->_private = c;
|
|
||||||
|
c = [c _initWithNode:(xmlNodePtr)newNode kind:internal->kind];
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue