summaryrefslogtreecommitdiff
path: root/tikzit/src
diff options
context:
space:
mode:
authorAlex Merry <dev@randomguy3.me.uk>2013-08-25 20:34:04 +0100
committerAlex Merry <dev@randomguy3.me.uk>2013-08-25 20:34:04 +0100
commit778d71f996a91273da7fa4625d0c66ceacb4cd63 (patch)
tree9ee17d70af28297443693167e8309f52a692d4fc /tikzit/src
parentf7292486b34034ffaa407f68bd267ec3ad01e693 (diff)
Memory management: release old shape dict when refreshed
Diffstat (limited to 'tikzit/src')
-rw-r--r--tikzit/src/common/Shape.m5
1 files changed, 4 insertions, 1 deletions
diff --git a/tikzit/src/common/Shape.m b/tikzit/src/common/Shape.m
index e86b122..eb466e2 100644
--- a/tikzit/src/common/Shape.m
+++ b/tikzit/src/common/Shape.m
@@ -129,11 +129,14 @@ NSDictionary *shapeDictionary = nil;
[Shape addShapesInDir:systemShapeDir to:shapeDict];
[Shape addShapesInDir:userShapeDir to:shapeDict];
+ NSDictionary *oldShapeDictionary = shapeDictionary;
shapeDictionary = shapeDict;
[[NSNotificationCenter defaultCenter]
postNotificationName:@"ShapeDictionaryReplaced"
object:self];
+
+ [oldShapeDictionary release];
}
+ (NSDictionary*)shapeDictionary {
@@ -142,7 +145,7 @@ NSDictionary *shapeDictionary = nil;
}
+ (Shape*)shapeForName:(NSString*)shapeName {
- Shape *s = [[[Shape shapeDictionary] objectForKey:shapeName] copy];
+ Shape *s = [[[self shapeDictionary] objectForKey:shapeName] copy];
return [s autorelease];
}