summaryrefslogtreecommitdiff
path: root/tikzit/src/common/Shape.m
diff options
context:
space:
mode:
Diffstat (limited to 'tikzit/src/common/Shape.m')
-rw-r--r--tikzit/src/common/Shape.m16
1 files changed, 16 insertions, 0 deletions
diff --git a/tikzit/src/common/Shape.m b/tikzit/src/common/Shape.m
index 5dc25e3..e887688 100644
--- a/tikzit/src/common/Shape.m
+++ b/tikzit/src/common/Shape.m
@@ -61,8 +61,12 @@
- (NSSet*)paths {return paths;}
- (void)setPaths:(NSSet *)p {
if (paths != p) {
+#if __has_feature(objc_arc)
+ paths = p;
+#else
[paths release];
paths = [p retain];
+#endif
[self calcBoundingRect];
}
}
@@ -79,9 +83,11 @@
}
- (void)dealloc {
+#if ! __has_feature(objc_arc)
[paths release];
[styleTikz release];
[super dealloc];
+#endif
}
NSDictionary *shapeDictionary = nil;
@@ -101,7 +107,9 @@ NSDictionary *shapeDictionary = nil;
[shapeDir stringByAppendingPathComponent:f]];
if (sh != nil) {
[shapeDict setObject:sh forKey:nm];
+#if ! __has_feature(objc_arc)
[sh release];
+#endif
}
}
}
@@ -122,7 +130,9 @@ NSDictionary *shapeDictionary = nil;
shapes[3], SHAPE_UP_TRIANGLE,
shapes[4], SHAPE_DOWN_TRIANGLE,
nil];
+#if ! __has_feature(objc_arc)
for (int i = 0; i<5; ++i) [shapes[i] release];
+#endif
NSString *systemShapeDir = [[SupportDir systemSupportDir] stringByAppendingPathComponent:@"shapes"];
NSString *userShapeDir = [[SupportDir userSupportDir] stringByAppendingPathComponent:@"shapes"];
@@ -137,7 +147,9 @@ NSDictionary *shapeDictionary = nil;
postNotificationName:@"ShapeDictionaryReplaced"
object:self];
+#if ! __has_feature(objc_arc)
[oldShapeDictionary release];
+#endif
}
+ (NSDictionary*)shapeDictionary {
@@ -147,7 +159,11 @@ NSDictionary *shapeDictionary = nil;
+ (Shape*)shapeForName:(NSString*)shapeName {
Shape *s = [[[self shapeDictionary] objectForKey:shapeName] copy];
+#if __has_feature(objc_arc)
+ return s;
+#else
return [s autorelease];
+#endif
}
@end