Revision: 7784
http://skim-app.svn.sourceforge.net/skim-app/?rev=7784&view=rev
Author: hofman
Date: 2012-11-05 01:01:52 +0000 (Mon, 05 Nov 2012)
Log Message:
-----------
use dispatch_once for singletons
Modified Paths:
--------------
trunk/SKDownloadController.m
trunk/SKInfoWindowController.m
trunk/SKLineInspector.m
trunk/SKNotesPanelController.m
trunk/SKReleaseNotesController.m
Modified: trunk/SKDownloadController.m
===================================================================
--- trunk/SKDownloadController.m 2012-11-04 23:30:56 UTC (rev 7783)
+++ trunk/SKDownloadController.m 2012-11-05 01:01:52 UTC (rev 7784)
@@ -74,16 +74,16 @@
@synthesize arrayController, tableView, clearButton, prefButton;
-static SKDownloadController *sharedDownloadController = nil;
-
+ (id)sharedDownloadController {
- if (sharedDownloadController == nil)
+ static SKDownloadController *sharedDownloadController = nil;
+ static dispatch_once_t predicate;
+ dispatch_once(&predicate, ^{
sharedDownloadController = [[self alloc] init];
+ });
return sharedDownloadController;
}
- (id)init {
- if (sharedDownloadController) NSLog(@"Attempt to allocate second instance
of %@", self);
self = [super initWithWindowNibName:@"DownloadsWindow"];
if (self) {
downloads = [[NSMutableArray alloc] init];
Modified: trunk/SKInfoWindowController.m
===================================================================
--- trunk/SKInfoWindowController.m 2012-11-04 23:30:56 UTC (rev 7783)
+++ trunk/SKInfoWindowController.m 2012-11-05 01:01:52 UTC (rev 7784)
@@ -84,16 +84,17 @@
[transformer release];
}
-static SKInfoWindowController *sharedInstance = nil;
-
+
+ (id)sharedInstance {
- if (sharedInstance == nil)
+ static SKInfoWindowController *sharedInstance = nil;
+ static dispatch_once_t predicate;
+ dispatch_once(&predicate, ^{
sharedInstance = [[self alloc] init];
+ });
return sharedInstance;
}
- (id)init {
- if (sharedInstance) NSLog(@"Attempt to allocate second instance of %@",
self);
self = [super initWithWindowNibName:@"InfoWindow"];
if (self){
info = nil;
Modified: trunk/SKLineInspector.m
===================================================================
--- trunk/SKLineInspector.m 2012-11-04 23:30:56 UTC (rev 7783)
+++ trunk/SKLineInspector.m 2012-11-05 01:01:52 UTC (rev 7784)
@@ -60,8 +60,10 @@
static SKLineInspector *sharedLineInspector = nil;
+ (id)sharedLineInspector {
- if (sharedLineInspector == nil)
+ static dispatch_once_t predicate;
+ dispatch_once(&predicate, ^{
sharedLineInspector = [[self alloc] init];
+ });
return sharedLineInspector;
}
@@ -70,7 +72,6 @@
}
- (id)init {
- if (sharedLineInspector) NSLog(@"Attempt to allocate second instance of
%@", self);
self = [super initWithWindowNibName:@"LineInspector"];
if (self) {
style = kPDFBorderStyleSolid;
Modified: trunk/SKNotesPanelController.m
===================================================================
--- trunk/SKNotesPanelController.m 2012-11-04 23:30:56 UTC (rev 7783)
+++ trunk/SKNotesPanelController.m 2012-11-05 01:01:52 UTC (rev 7784)
@@ -47,8 +47,10 @@
static SKNotesPanelController *sharedController = nil;
+ (id)sharedController {
- if (sharedController == nil)
+ static dispatch_once_t predicate;
+ dispatch_once(&predicate, ^{
sharedController = [[self alloc] init];
+ });
return sharedController;
}
Modified: trunk/SKReleaseNotesController.m
===================================================================
--- trunk/SKReleaseNotesController.m 2012-11-04 23:30:56 UTC (rev 7783)
+++ trunk/SKReleaseNotesController.m 2012-11-05 01:01:52 UTC (rev 7784)
@@ -43,16 +43,16 @@
@synthesize textView;
-static SKReleaseNotesController *sharedReleaseNotesController = nil;
-
+ (id)sharedReleaseNotesController {
- if (sharedReleaseNotesController == nil)
+ static SKReleaseNotesController *sharedReleaseNotesController = nil;
+ static dispatch_once_t predicate;
+ dispatch_once(&predicate, ^{
sharedReleaseNotesController = [[self alloc] init];
+ });
return sharedReleaseNotesController;
}
- (id)init {
- if (sharedReleaseNotesController) NSLog(@"Attempt to allocate second
instance of %@", self);
return [super initWithWindowNibName:@"ReleaseNotes"];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit