Author: mlytwyn
Date: Fri Mar 24 16:55:57 2017
New Revision: 40412
URL: http://svn.gna.org/viewcvs/gnustep?rev=40412&view=rev
Log:
Fix excess objects and memory leaks from XIB5 loading
Modified:
libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.h
libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.m
Modified:
libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.h?rev=40412&r1=40411&r2=40412&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.h
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.h
Fri Mar 24 16:55:57 2017
@@ -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;
Modified:
libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.m?rev=40412&r1=40411&r2=40412&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.m
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.m
Fri Mar 24 16:55:57 2017
@@ -641,6 +641,8 @@
{
[super _initCommon];
+ _orderedObjectsDict = RETAIN([NSMutableDictionary dictionary]);
+
// Create our object(s)...
_connectionRecords = [[GSXib5Element alloc] initWithType: @"array"
andAttributes: @{ @"key" :
@"connectionRecords" }];
@@ -683,6 +685,7 @@
RELEASE(_flattenedProperties);
RELEASE(_runtimeAttributes);
RELEASE(_orderedObjects);
+ RELEASE(_orderedObjectsDict);
[super dealloc];
}
@@ -2809,8 +2812,15 @@
// 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"])
{
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs