Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support compiling with ARC under Clang using ifdefs.

  • Loading branch information...
commit da1479062a67bc6bd9a57f9e8b2af2a23f67cb8a 1 parent d5aa8ae
@atombender authored
Showing with 20 additions and 3 deletions.
  1. +20 −3 MASPreferencesWindowController.m
View
23 MASPreferencesWindowController.m
@@ -38,7 +38,11 @@ - (id)initWithViewControllers:(NSArray *)viewControllers title:(NSString *)title
{
if ((self = [super initWithWindowNibName:@"MASPreferencesWindow"]))
{
+#if __has_feature(objc_arc)
+ _viewControllers = viewControllers;
+#else
_viewControllers = [viewControllers retain];
+#endif
_minimumViewRects = [[NSMutableDictionary alloc] init];
_title = [title copy];
}
@@ -49,13 +53,13 @@ - (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[self window] setDelegate:nil];
-
+#if !__has_feature(objc_arc)
[_viewControllers release];
[_selectedViewController release];
[_minimumViewRects release];
[_title release];
-
[super dealloc];
+#endif
}
#pragma mark -
@@ -160,7 +164,10 @@ - (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString
toolbarItem.target = self;
toolbarItem.action = @selector(toolbarItemDidClick:);
}
- return [toolbarItem autorelease];
+#if !__has_feature(objc_arc)
+ [toolbarItem autorelease];
+#endif
+ return toolbarItem;
}
#pragma mark -
@@ -216,11 +223,17 @@ - (void)setSelectedViewController:(NSViewController <MASPreferencesViewControlle
return;
}
+#if __has_feature(objc_arc)
+ [self.window setContentView:[[NSView alloc] init]];
+#else
[self.window setContentView:[[[NSView alloc] init] autorelease]];
+#endif
if ([_selectedViewController respondsToSelector:@selector(viewDidDisappear)])
[_selectedViewController viewDidDisappear];
+#if !__has_feature(objc_arc)
[_selectedViewController release];
+#endif
_selectedViewController = nil;
}
@@ -267,7 +280,11 @@ - (void)setSelectedViewController:(NSViewController <MASPreferencesViewControlle
[self.window setFrame:newFrame display:YES animate:[self.window isVisible]];
+#if __has_feature(objc_arc)
+ _selectedViewController = controller;
+#else
_selectedViewController = [controller retain];
+#endif
if ([controller respondsToSelector:@selector(viewWillAppear)])
[controller viewWillAppear];
Please sign in to comment.
Something went wrong with that request. Please try again.