mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Finished cleaning up singleton stuff in SUUpdater.m
This commit is contained in:
1 parent
5bf76dd7a3
commit
2ec35aebdf
1 file changed
+8
-11
+8
-11
@@ -33,27 +33,24 @@ static SUUpdater *sharedUpdater = nil;
|
||||
|
||||
// SUUpdater's a singleton now! And I'm enforcing it!
|
||||
// This will probably break the world if you try to write a Sparkle-enabled plugin for a Sparkle-enabled app.
|
||||
+ (id)allocWithZone:(NSZone *)zone
|
||||
{
|
||||
if ([self class] != [SUUpdater class] || sharedUpdater == nil)
|
||||
sharedUpdater = [super allocWithZone:zone];
|
||||
else
|
||||
[sharedUpdater retain];
|
||||
return sharedUpdater;
|
||||
}
|
||||
|
||||
+ (SUUpdater *)sharedUpdater
|
||||
{
|
||||
if (sharedUpdater == nil)
|
||||
[[[self class] alloc] init];
|
||||
sharedUpdater = [[[self class] alloc] init];
|
||||
return sharedUpdater;
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
if (sharedUpdater)
|
||||
{
|
||||
[self release];
|
||||
self = sharedUpdater;
|
||||
}
|
||||
else if (self != nil)
|
||||
{
|
||||
sharedUpdater = self;
|
||||
[self setHostBundle:[NSBundle mainBundle]];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidFinishLaunching:) name:NSApplicationDidFinishLaunchingNotification object:NSApp];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user