aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPExportController.m6
-rw-r--r--Source/SPGrowlController.m12
-rw-r--r--Source/SPLogger.m20
-rw-r--r--Source/SPNotLoaded.m7
-rw-r--r--Source/SPQueryController.m10
5 files changed, 23 insertions, 32 deletions
diff --git a/Source/SPExportController.m b/Source/SPExportController.m
index c1e72b8a..caa504e7 100644
--- a/Source/SPExportController.m
+++ b/Source/SPExportController.m
@@ -449,8 +449,8 @@
[errors appendString:[NSString stringWithFormat:@"%@\n", [connection getLastErrorMessage]]];
}
- SPExporter *exporter;
- SPCSVExporter *csvExporter;
+ SPExporter *exporter = nil;
+ SPCSVExporter *csvExporter = nil;
// Based on the type of export create a new instance of the corresponding exporter and set it's specific options
switch (type)
@@ -508,6 +508,8 @@
// maximum number of concurrent operations. See the docs for more details.
[operationQueue addOperation:exporter];
+ if (csvExporter) [csvExporter release];
+
// Add a spacer to the file
//[fileHandle writeData:[[NSString stringWithFormat:@"%@%@%@", csvLineEnd, csvLineEnd, csvLineEnd] dataUsingEncoding:encoding]];
}
diff --git a/Source/SPGrowlController.m b/Source/SPGrowlController.m
index 0e41a258..13d06f3c 100644
--- a/Source/SPGrowlController.m
+++ b/Source/SPGrowlController.m
@@ -39,7 +39,7 @@ static SPGrowlController *sharedGrowlController = nil;
{
@synchronized(self) {
if (sharedGrowlController == nil) {
- [[self alloc] init];
+ sharedGrowlController = [[super allocWithZone:NULL] init];
}
}
@@ -49,14 +49,8 @@ static SPGrowlController *sharedGrowlController = nil;
+ (id)allocWithZone:(NSZone *)zone
{
@synchronized(self) {
- if (sharedGrowlController == nil) {
- sharedGrowlController = [super allocWithZone:zone];
-
- return sharedGrowlController;
- }
- }
-
- return nil; // On subsequent allocation attempts return nil
+ return [[self sharedGrowlController] retain];
+ }
}
- (id)init
diff --git a/Source/SPLogger.m b/Source/SPLogger.m
index 9d8f7a92..d492fe32 100644
--- a/Source/SPLogger.m
+++ b/Source/SPLogger.m
@@ -47,7 +47,7 @@ static SPLogger *logger = nil;
{
@synchronized(self) {
if (logger == nil) {
- [[self alloc] init];
+ logger = [[super allocWithZone:NULL] init];
}
}
@@ -60,16 +60,20 @@ static SPLogger *logger = nil;
+ (id)allocWithZone:(NSZone *)zone
{
@synchronized(self) {
- if (logger == nil) {
- logger = [super allocWithZone:zone];
-
- return logger;
- }
+ return [[self logger] retain];
}
-
- return nil;
}
+- (id)copyWithZone:(NSZone *)zone { return self; }
+
+- (id)retain { return self; }
+
+- (NSUInteger)retainCount { return NSUIntegerMax; }
+
+- (void)release {}
+
+- (id)autorelease { return self; }
+
- (id)init
{
if ((self = [super init])) {
diff --git a/Source/SPNotLoaded.m b/Source/SPNotLoaded.m
index e1e76806..6814e2e8 100644
--- a/Source/SPNotLoaded.m
+++ b/Source/SPNotLoaded.m
@@ -34,7 +34,7 @@ static SPNotLoaded *notLoaded = nil;
{
@synchronized(self) {
if (notLoaded == nil) {
- [[self alloc] init];
+ notLoaded = [[super allocWithZone:NULL] init];
}
}
return notLoaded;
@@ -43,11 +43,8 @@ static SPNotLoaded *notLoaded = nil;
+ (id) allocWithZone:(NSZone *)zone
{
@synchronized(self) {
- if (notLoaded == nil) {
- return [super allocWithZone:zone];
- }
+ return [[self notLoaded] retain];
}
- return notLoaded;
}
- (id) init
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index fec04630..b7fd77c3 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -62,7 +62,7 @@ static SPQueryController *sharedQueryController = nil;
{
@synchronized(self) {
if (sharedQueryController == nil) {
- [[self alloc] init];
+ sharedQueryController = [[super allocWithZone:NULL] init];
}
}
@@ -72,14 +72,8 @@ static SPQueryController *sharedQueryController = nil;
+ (id)allocWithZone:(NSZone *)zone
{
@synchronized(self) {
- if (sharedQueryController == nil) {
- sharedQueryController = [super allocWithZone:zone];
-
- return sharedQueryController;
- }
+ return [[self sharedQueryController] retain];
}
-
- return nil; // On subsequent allocation attempts return nil
}
- (id)init