mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 03:11:18 +00:00
Fix excess objects and memory leaks from XIB5 loading
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@40412 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8276bb0924
commit
d5242088e8
2 changed files with 19 additions and 8 deletions
|
@ -33,12 +33,13 @@
|
|||
|
||||
@interface GSXib5KeyedUnarchiver : GSXibKeyedUnarchiver
|
||||
{
|
||||
GSXib5Element *_IBObjectContainer;
|
||||
GSXib5Element *_connectionRecords;
|
||||
GSXib5Element *_objectRecords;
|
||||
GSXib5Element *_orderedObjects;
|
||||
GSXib5Element *_flattenedProperties;
|
||||
GSXib5Element *_runtimeAttributes;
|
||||
GSXib5Element *_IBObjectContainer;
|
||||
GSXib5Element *_connectionRecords;
|
||||
GSXib5Element *_objectRecords;
|
||||
GSXib5Element *_orderedObjects;
|
||||
GSXib5Element *_flattenedProperties;
|
||||
GSXib5Element *_runtimeAttributes;
|
||||
NSMutableDictionary *_orderedObjectsDict;
|
||||
}
|
||||
|
||||
- (NSRange) decodeRangeForKey: (NSString*)key;
|
||||
|
|
|
@ -641,6 +641,8 @@ static NSArray *XmlConnectionRecordTags = nil;
|
|||
{
|
||||
[super _initCommon];
|
||||
|
||||
_orderedObjectsDict = RETAIN([NSMutableDictionary dictionary]);
|
||||
|
||||
// Create our object(s)...
|
||||
_connectionRecords = [[GSXib5Element alloc] initWithType: @"array"
|
||||
andAttributes: @{ @"key" : @"connectionRecords" }];
|
||||
|
@ -683,6 +685,7 @@ static NSArray *XmlConnectionRecordTags = nil;
|
|||
RELEASE(_flattenedProperties);
|
||||
RELEASE(_runtimeAttributes);
|
||||
RELEASE(_orderedObjects);
|
||||
RELEASE(_orderedObjectsDict);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -2809,8 +2812,15 @@ didStartElement: (NSString*)elementName
|
|||
// Create an ordered object for this element...
|
||||
// This probably needs to be qualified but I have yet to determine
|
||||
// what that should be right now...
|
||||
[_orderedObjects addElement: [self orderedObjectForElement: (GSXib5Element*)element]];
|
||||
|
||||
// OK - I think we need at least this qualifier here to avoid excess and
|
||||
// objects and memory leaks...
|
||||
if ([element attributeForKey: @"id"] && [_orderedObjectsDict objectForKey: [element attributeForKey: @"id"]] == nil)
|
||||
{
|
||||
id orderedObject = [self orderedObjectForElement: (GSXib5Element*)element];
|
||||
[_orderedObjectsDict setObject: orderedObject forKey: [element attributeForKey: @"id"]];
|
||||
[_orderedObjects addElement: orderedObject];
|
||||
}
|
||||
|
||||
// Process tooltips...
|
||||
if ([element attributeForKey: @"toolTip"])
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue