Revision: 5665
http://skim-app.svn.sourceforge.net/skim-app/?rev=5665&view=rev
Author: hofman
Date: 2009-09-04 14:18:49 +0000 (Fri, 04 Sep 2009)
Log Message:
-----------
Don't override memory management methods for singletons, just use proper memory
management
Modified Paths:
--------------
trunk/SKApplicationController.m
trunk/SKBookmarkController.m
trunk/SKDownloadController.m
trunk/SKFindController.m
trunk/SKInfoWindowController.m
trunk/SKLineInspector.m
trunk/SKNavigationWindow.m
trunk/SKNotesPanelController.m
trunk/SKPDFToolTipWindow.m
trunk/SKPreferenceController.m
trunk/SKReleaseNotesController.m
trunk/SKRemoteStateWindow.m
Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m 2009-09-04 14:03:31 UTC (rev 5664)
+++ trunk/SKApplicationController.m 2009-09-04 14:18:49 UTC (rev 5665)
@@ -119,28 +119,20 @@
+ (id)sharedApplicationController {
if (sharedApplicationController == nil)
- [[self alloc] init];
+ [[[self alloc] init] release];
return sharedApplicationController;
}
+ (id)allocWithZone:(NSZone *)zone {
- return sharedApplicationController ?: [super allocWithZone:zone];
+ return [sharedApplicationController retain] ?: [super allocWithZone:zone];
}
- (id)init {
if (sharedApplicationController == nil)
- sharedApplicationController = [super init];
+ sharedApplicationController = [[super init] retain];
return sharedApplicationController;
}
-- (id)retain { return self; }
-
-- (id)autorelease { return self; }
-
-- (void)release {}
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
- (void)awakeFromNib {
NSMenu *viewMenu = [[[NSApp mainMenu] itemAtIndex:VIEW_MENU_INDEX]
submenu];
NSInteger i, count = [viewMenu numberOfItems];
Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m 2009-09-04 14:03:31 UTC (rev 5664)
+++ trunk/SKBookmarkController.m 2009-09-04 14:18:49 UTC (rev 5665)
@@ -107,16 +107,16 @@
+ (id)sharedBookmarkController {
if (sharedBookmarkController == nil)
- [[self alloc] init];
+ [[[self alloc] init] release];
return sharedBookmarkController;
}
+ (id)allocWithZone:(NSZone *)zone {
- return sharedBookmarkController ?: [super allocWithZone:zone];
+ return [sharedBookmarkController retain] ?: [super allocWithZone:zone];
}
- (id)init {
- if (sharedBookmarkController == nil && (sharedBookmarkController = self =
[super initWithWindowNibName:@"BookmarksWindow"])) {
+ if (sharedBookmarkController == nil && (self = [super
initWithWindowNibName:@"BookmarksWindow"])) {
recentDocuments = [[NSMutableArray alloc] init];
NSMutableArray *bookmarks = [NSMutableArray array];
@@ -153,8 +153,10 @@
selector:@selector(handleApplicationWillTerminateNotification:)
name:NSApplicationWillTerminateNotification
object:NSApp];
+
+ sharedBookmarkController = [self retain];
}
- return sharedBookmarkController;
+ return self;
}
- (void)dealloc {
@@ -168,14 +170,6 @@
[super dealloc];
}
-- (id)retain { return self; }
-
-- (id)autorelease { return self; }
-
-- (void)release {}
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
- (void)windowDidLoad {
[self setupToolbar];
Modified: trunk/SKDownloadController.m
===================================================================
--- trunk/SKDownloadController.m 2009-09-04 14:03:31 UTC (rev 5664)
+++ trunk/SKDownloadController.m 2009-09-04 14:18:49 UTC (rev 5665)
@@ -70,19 +70,20 @@
+ (id)sharedDownloadController {
if (sharedDownloadController == nil)
- [[self alloc] init];
+ [[[self alloc] init] release];
return sharedDownloadController;
}
+ (id)allocWithZone:(NSZone *)zone {
- return sharedDownloadController ?: [super allocWithZone:zone];
+ return [sharedDownloadController retain] ?: [super allocWithZone:zone];
}
- (id)init {
- if (sharedDownloadController == nil && (sharedDownloadController = self =
[super initWithWindowNibName:@"DownloadsWindow"])) {
+ if (sharedDownloadController == nil && (self = [super
initWithWindowNibName:@"DownloadsWindow"])) {
downloads = [[NSMutableArray alloc] init];
+ sharedDownloadController = [self retain];
}
- return sharedDownloadController;
+ return self;
}
- (void)dealloc {
@@ -91,14 +92,6 @@
[super dealloc];
}
-- (id)retain { return self; }
-
-- (id)autorelease { return self; }
-
-- (void)release {}
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
- (void)windowDidLoad {
[self setWindowFrameAutosaveName:SKDownloadsWindowFrameAutosaveName];
Modified: trunk/SKFindController.m
===================================================================
--- trunk/SKFindController.m 2009-09-04 14:03:31 UTC (rev 5664)
+++ trunk/SKFindController.m 2009-09-04 14:18:49 UTC (rev 5665)
@@ -47,19 +47,20 @@
+ (id)sharedFindController {
if (sharedFindController == nil)
- [[self alloc] init];
+ [[[self alloc] init] release];
return sharedFindController;
}
+ (id)allocWithZone:(NSZone *)zone {
- return sharedFindController ?: [super allocWithZone:zone];
+ return [sharedFindController retain] ?: [super allocWithZone:zone];
}
- (id)init {
- if (sharedFindController == nil && (sharedFindController = self = [super
initWithWindowNibName:@"FindPanel"])) {
+ if (sharedFindController == nil && (self = [super
initWithWindowNibName:@"FindPanel"])) {
ignoreCase = YES;
+ sharedFindController = [self retain];
}
- return sharedFindController;
+ return self;
}
- (void)dealloc {
@@ -67,14 +68,6 @@
[super dealloc];
}
-- (id)retain { return self; }
-
-- (id)autorelease { return self; }
-
-- (void)release {}
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
- (void)windowDidLoad {
[self setWindowFrameAutosaveName:SKFindPanelFrameAutosaveName];
[[self window]
setCollectionBehavior:NSWindowCollectionBehaviorMoveToActiveSpace];
Modified: trunk/SKInfoWindowController.m
===================================================================
--- trunk/SKInfoWindowController.m 2009-09-04 14:03:31 UTC (rev 5664)
+++ trunk/SKInfoWindowController.m 2009-09-04 14:18:49 UTC (rev 5665)
@@ -73,19 +73,20 @@
+ (id)sharedInstance {
if (sharedInstance == nil)
- [[self alloc] init];
+ [[[self alloc] init] release];
return sharedInstance;
}
+ (id)allocWithZone:(NSZone *)zone {
- return sharedInstance ?: [super allocWithZone:zone];
+ return [sharedInstance retain] ?: [super allocWithZone:zone];
}
- (id)init {
- if (sharedInstance == nil && (sharedInstance = self = [super
initWithWindowNibName:@"InfoWindow"])) {
+ if (sharedInstance == nil && (self = [super
initWithWindowNibName:@"InfoWindow"])) {
info = nil;
+ sharedInstance = [self retain];
}
- return sharedInstance;
+ return self;
}
- (void)dealloc {
@@ -94,14 +95,6 @@
[super dealloc];
}
-- (id)retain { return self; }
-
-- (id)autorelease { return self; }
-
-- (void)release {}
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
- (void)windowDidLoad {
[self setWindowFrameAutosaveName:SKInfoWindowFrameAutosaveName];
Modified: trunk/SKLineInspector.m
===================================================================
--- trunk/SKLineInspector.m 2009-09-04 14:03:31 UTC (rev 5664)
+++ trunk/SKLineInspector.m 2009-09-04 14:18:49 UTC (rev 5665)
@@ -59,7 +59,7 @@
+ (id)sharedLineInspector {
if (sharedLineInspector == nil)
- [[self alloc] init];
+ [[[self alloc] init] release];
return sharedLineInspector;
}
@@ -68,19 +68,20 @@
}
+ (id)allocWithZone:(NSZone *)zone {
- return sharedLineInspector ?: [super allocWithZone:zone];
+ return [sharedLineInspector retain] ?: [super allocWithZone:zone];
}
- (id)init {
- if (sharedLineInspector == nil && (sharedLineInspector = self = [super
initWithWindowNibName:@"LineInspector"])) {
+ if (sharedLineInspector == nil && (self = [super
initWithWindowNibName:@"LineInspector"])) {
style = kPDFBorderStyleSolid;
lineWidth = 1.0;
dashPattern = nil;
startLineStyle = kPDFLineStyleNone;
endLineStyle = kPDFLineStyleNone;
currentLineChangeAction = SKNoLineChangeAction;
+ sharedLineInspector = [self retain];
}
- return sharedLineInspector;
+ return self;
}
- (void)dealloc {
@@ -88,14 +89,6 @@
[super dealloc];
}
-- (id)retain { return self; }
-
-- (id)autorelease { return self; }
-
-- (void)release {}
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
- (void)windowDidLoad {
[self setWindowFrameAutosaveName:SKLineInspectorFrameAutosaveName];
Modified: trunk/SKNavigationWindow.m
===================================================================
--- trunk/SKNavigationWindow.m 2009-09-04 14:03:31 UTC (rev 5664)
+++ trunk/SKNavigationWindow.m 2009-09-04 14:18:49 UTC (rev 5665)
@@ -197,16 +197,16 @@
+ (id)sharedToolTipWindow {
if (sharedToolTipWindow == nil)
- [[self alloc] init];
+ [[[self alloc] init] retain];
return sharedToolTipWindow;
}
+ (id)allocWithZone:(NSZone *)zone {
- return sharedToolTipWindow ?: [super allocWithZone:zone];
+ return [sharedToolTipWindow retain] ?: [super allocWithZone:zone];
}
- (id)init {
- if (sharedToolTipWindow == nil && (sharedToolTipWindow = self = [super
initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered defer:YES screen:[NSScreen mainScreen]])) {
+ if (sharedToolTipWindow == nil && (self = [super
initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered defer:YES screen:[NSScreen mainScreen]])) {
[self setBackgroundColor:[NSColor clearColor]];
[self setOpaque:NO];
[self setDisplaysWhenScreenProfileChanges:YES];
@@ -214,18 +214,12 @@
toolTipView = [[[SKNavigationToolTipView alloc] init] autorelease];
[[self contentView] addSubview:toolTipView];
+
+ sharedToolTipWindow = [self retain];
}
return self;
}
-- (id)retain { return self; }
-
-- (id)autorelease { return self; }
-
-- (void)release {}
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
- (BOOL)canBecomeKeyWindow { return NO; }
- (BOOL)canBecomeMainWindow { return NO; }
Modified: trunk/SKNotesPanelController.m
===================================================================
--- trunk/SKNotesPanelController.m 2009-09-04 14:03:31 UTC (rev 5664)
+++ trunk/SKNotesPanelController.m 2009-09-04 14:18:49 UTC (rev 5665)
@@ -47,7 +47,7 @@
+ (id)sharedController {
if (sharedController == nil)
- [[self alloc] init];
+ [[[self alloc] init] release];
return sharedController;
}
@@ -56,24 +56,16 @@
}
+ (id)allocWithZone:(NSZone *)zone {
- return sharedController ?: [super allocWithZone:[self zone]];
+ return [sharedController retain] ?: [super allocWithZone:[self zone]];
}
- (id)init {
if (sharedController == nil && (self = [super
initWithWindowNibName:@"NotesPanel"])) {
- sharedController = self;
+ sharedController = [self retain];
}
- return sharedController;
+ return self;
}
-- (id)retain { return self; }
-
-- (id)autorelease { return self; }
-
-- (void)release {}
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
- (void)windowDidLoad {
[self setWindowFrameAutosaveName:SKNotesPanelFrameAutosaveName];
}
Modified: trunk/SKPDFToolTipWindow.m
===================================================================
--- trunk/SKPDFToolTipWindow.m 2009-09-04 14:03:31 UTC (rev 5664)
+++ trunk/SKPDFToolTipWindow.m 2009-09-04 14:18:49 UTC (rev 5665)
@@ -69,19 +69,19 @@
+ (id)sharedToolTipWindow {
if (sharedToolTipWindow == nil)
- [[self alloc] init];
+ [[[self alloc] init] release];
return sharedToolTipWindow;
}
+ (id)allocWithZone:(NSZone *)zone {
- return sharedToolTipWindow ?: [super allocWithZone:zone];
+ return [sharedToolTipWindow retain] ?: [super allocWithZone:zone];
}
- (id)init {
- if (sharedToolTipWindow == nil && (sharedToolTipWindow = self = [super
initWithContentRect:NSZeroRect])) {
+ if (sharedToolTipWindow == nil && (self = [super
initWithContentRect:NSZeroRect])) {
[self setHidesOnDeactivate:NO];
[self setIgnoresMouseEvents:YES];
- [self setOpaque:YES];
+ [self setOpaque:YES];
[self setBackgroundColor:[NSColor whiteColor]];
[self setHasShadow:YES];
[self setLevel:NSStatusWindowLevel];
@@ -102,8 +102,10 @@
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleApplicationWillResignActiveNotification:)
name:NSApplicationWillResignActiveNotification object:NSApp];
+
+ sharedToolTipWindow = [self retain];
}
- return sharedToolTipWindow;
+ return self;
}
- (void)dealloc {
@@ -114,14 +116,6 @@
[super dealloc];
}
-- (id)retain { return self; }
-
-- (id)autorelease { return self; }
-
-- (void)release {}
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
- (NSFont *)font {
return font;
}
Modified: trunk/SKPreferenceController.m
===================================================================
--- trunk/SKPreferenceController.m 2009-09-04 14:03:31 UTC (rev 5664)
+++ trunk/SKPreferenceController.m 2009-09-04 14:18:49 UTC (rev 5665)
@@ -69,16 +69,16 @@
+ (id)sharedPrefenceController {
if (sharedPrefenceController == nil)
- [[self alloc] init];
+ [[[self alloc] init] release];
return sharedPrefenceController;
}
+ (id)allocWithZone:(NSZone *)zone {
- return sharedPrefenceController ?: [super allocWithZone:zone];
+ return [sharedPrefenceController retain] ?: [super allocWithZone:zone];
}
- (id)init {
- if (sharedPrefenceController == nil && (sharedPrefenceController = self =
[super initWithWindowNibName:@"PreferenceWindow"])) {
+ if (sharedPrefenceController == nil && (self = [super
initWithWindowNibName:@"PreferenceWindow"])) {
NSString *initialUserDefaultsPath = [[NSBundle mainBundle]
pathForResource:INITIALUSERDEFAULTS_KEY ofType:@"plist"];
resettableKeys = [[[NSDictionary
dictionaryWithContentsOfFile:initialUserDefaultsPath]
valueForKey:RESETTABLEKEYS_KEY] retain];
@@ -87,8 +87,10 @@
[sudc addObserver:self forKeys:[NSArray
arrayWithObjects:SKDefaultPDFDisplaySettingsKey,
SKDefaultFullScreenPDFDisplaySettingsKey, nil]
context:&SKPreferenceWindowDefaultsObservationContext];
[[SUUpdater sharedUpdater] addObserver:self
forKeyPath:@"automaticallyChecksForUpdates" options:0
context:&SKPreferenceWindowUpdaterObservationContext];
[[SUUpdater sharedUpdater] addObserver:self
forKeyPath:@"updateCheckInterval" options:0
context:&SKPreferenceWindowUpdaterObservationContext];
+
+ sharedPrefenceController = [self retain];
}
- return sharedPrefenceController;
+ return self;
}
- (void)dealloc {
@@ -99,14 +101,6 @@
[super dealloc];
}
-- (id)retain { return self; }
-
-- (id)autorelease { return self; }
-
-- (void)release {}
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
#define VALUES_KEY_PATH(key) [@"values." stringByAppendingString:key]
- (void)windowDidLoad {
Modified: trunk/SKReleaseNotesController.m
===================================================================
--- trunk/SKReleaseNotesController.m 2009-09-04 14:03:31 UTC (rev 5664)
+++ trunk/SKReleaseNotesController.m 2009-09-04 14:18:49 UTC (rev 5665)
@@ -45,29 +45,21 @@
+ (id)sharedReleaseNotesController {
if (sharedReleaseNotesController == nil)
- [[self alloc] init];
+ [[[self alloc] init] release];
return sharedReleaseNotesController;
}
+ (id)allocWithZone:(NSZone *)zone {
- return sharedReleaseNotesController ?: [super allocWithZone:zone];
+ return [sharedReleaseNotesController retain] ?: [super allocWithZone:zone];
}
- (id)init {
if (sharedReleaseNotesController == nil) {
- sharedReleaseNotesController = [super
initWithWindowNibName:@"ReleaseNotes"];
+ sharedReleaseNotesController = [[super
initWithWindowNibName:@"ReleaseNotes"] retain];
}
- return sharedReleaseNotesController;
+ return self;
}
-- (id)retain { return self; }
-
-- (id)autorelease { return self; }
-
-- (void)release {}
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
- (void)windowDidLoad {
[[self window] setTitle:NSLocalizedString(@"Release Notes", @"window
title")];
[textView setString:@""];
Modified: trunk/SKRemoteStateWindow.m
===================================================================
--- trunk/SKRemoteStateWindow.m 2009-09-04 14:03:31 UTC (rev 5664)
+++ trunk/SKRemoteStateWindow.m 2009-09-04 14:18:49 UTC (rev 5665)
@@ -58,36 +58,28 @@
+ (id)sharedRemoteStateWindow {
if (sharedRemoteStateWindow == nil)
- [[self alloc] init];
+ [[[self alloc] init] release];
return sharedRemoteStateWindow;
}
+ (id)allocWithZone:(NSZone *)zone {
- return sharedRemoteStateWindow ? sharedRemoteStateWindow : [super
allocWithZone:zone];
+ return [sharedRemoteStateWindow retain] ?: [super allocWithZone:zone];
}
- (id)init {
if (sharedRemoteStateWindow == nil) {
NSRect contentRect = SKRectFromCenterAndSize(NSZeroPoint,
SKMakeSquareSize(WINDOW_SIZE));
if (self = [super initWithContentRect:contentRect]) {
- sharedRemoteStateWindow = self;
[self setIgnoresMouseEvents:YES];
[self setDisplaysWhenScreenProfileChanges:NO];
[self setLevel:NSStatusWindowLevel];
[self setContentView:[[[SKRemoteStateView alloc] init]
autorelease]];
+ sharedRemoteStateWindow = [self retain];
}
}
- return sharedRemoteStateWindow;
+ return self;
}
-- (id)retain { return self; }
-
-- (id)autorelease { return self; }
-
-- (void)release {}
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
- (CGFloat)defaultAlphaValue { return ALPHA_VALUE; }
- (NSTimeInterval)autoHideTimeInterval {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit