diff options
author | Alex Merry <dev@randomguy3.me.uk> | 2013-08-25 20:34:04 +0100 |
---|---|---|
committer | Alex Merry <dev@randomguy3.me.uk> | 2013-08-25 20:34:04 +0100 |
commit | 778d71f996a91273da7fa4625d0c66ceacb4cd63 (patch) | |
tree | 9ee17d70af28297443693167e8309f52a692d4fc | |
parent | f7292486b34034ffaa407f68bd267ec3ad01e693 (diff) |
Memory management: release old shape dict when refreshed
-rw-r--r-- | tikzit/src/common/Shape.m | 5 |
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]; } |