Removed singleton nonsense.
This commit is contained in:
parent
276176a80c
commit
dd89208ee0
2 changed files with 3 additions and 41 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#import "Plugin.h"
|
#import "Plugin.h"
|
||||||
|
|
||||||
//Singleton
|
//Singletonish
|
||||||
@interface PluginController : NSObject <CogPluginController>
|
@interface PluginController : NSObject <CogPluginController>
|
||||||
{
|
{
|
||||||
NSMutableDictionary *sources;
|
NSMutableDictionary *sources;
|
||||||
|
|
|
@ -15,57 +15,19 @@
|
||||||
|
|
||||||
@synthesize configured;
|
@synthesize configured;
|
||||||
|
|
||||||
//Start of singleton-related stuff.
|
|
||||||
static PluginController *sharedPluginController = nil;
|
static PluginController *sharedPluginController = nil;
|
||||||
|
|
||||||
+ (id<CogPluginController>)sharedPluginController
|
+ (id<CogPluginController>)sharedPluginController
|
||||||
{
|
{
|
||||||
@synchronized(self) {
|
@synchronized(self) {
|
||||||
if (sharedPluginController == nil) {
|
if (sharedPluginController == nil) {
|
||||||
[[self alloc] init]; // assignment not done here
|
sharedPluginController = [[self alloc] init];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sharedPluginController;
|
return sharedPluginController;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id)allocWithZone:(NSZone *)zone
|
|
||||||
{
|
|
||||||
@synchronized(self) {
|
|
||||||
if (sharedPluginController == nil) {
|
|
||||||
sharedPluginController = [super allocWithZone:zone];
|
|
||||||
return sharedPluginController; // assignment and return on first allocation
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil; //on subsequent allocation attempts return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)copyWithZone:(NSZone *)zone
|
|
||||||
{
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)retain
|
|
||||||
{
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (unsigned)retainCount
|
|
||||||
{
|
|
||||||
return UINT_MAX; //denotes an object that cannot be released
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)release
|
|
||||||
{
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)autorelease
|
|
||||||
{
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
//End of singleton-related stuff
|
|
||||||
|
|
||||||
- (id)init {
|
- (id)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
Loading…
Reference in a new issue