Revision: 7112
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7112&view=rev
Author:   hofman
Date:     2011-02-18 10:47:30 +0000 (Fri, 18 Feb 2011)

Log Message:
-----------
log attempts to create multiple singleton instances

Modified Paths:
--------------
    trunk/SKBookmarkController.m
    trunk/SKDownloadController.m
    trunk/SKFindController.m
    trunk/SKImageToolTipWindow.m
    trunk/SKInfoWindowController.m
    trunk/SKLineInspector.m
    trunk/SKNotesPanelController.m
    trunk/SKPreferenceController.m
    trunk/SKReleaseNotesController.m

Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m        2011-02-16 13:33:26 UTC (rev 7111)
+++ trunk/SKBookmarkController.m        2011-02-18 10:47:30 UTC (rev 7112)
@@ -154,7 +154,7 @@
         }
         sharedBookmarkController = [self retain];
     } else if (self != sharedBookmarkController) {
-        NSLog(@"shouldn't be able to create multiple instances");
+        NSLog(@"Attempt to allocate second instance of %@", [self class]);
         [self release];
         self = [sharedBookmarkController retain];
     }

Modified: trunk/SKDownloadController.m
===================================================================
--- trunk/SKDownloadController.m        2011-02-16 13:33:26 UTC (rev 7111)
+++ trunk/SKDownloadController.m        2011-02-18 10:47:30 UTC (rev 7112)
@@ -72,13 +72,19 @@
 
 @synthesize arrayController, tableView, clearButton, prefButton;
 
+static SKDownloadController *sharedDownloadController = nil;
+
 + (id)sharedDownloadController {
-    static SKDownloadController *sharedDownloadController = nil;
     if (sharedDownloadController == nil)
         sharedDownloadController = [[self alloc] init];
     return sharedDownloadController;
 }
 
++ (id)allocWithZone:(NSZone *)zone {
+    if (sharedDownloadController) NSLog(@"Attempt to allocate second instance 
of %@", self);
+    return [super allocWithZone:zone];
+}
+
 - (id)init {
     if (self = [super initWithWindowNibName:@"DownloadsWindow"]) {
         downloads = [[NSMutableArray alloc] init];

Modified: trunk/SKFindController.m
===================================================================
--- trunk/SKFindController.m    2011-02-16 13:33:26 UTC (rev 7111)
+++ trunk/SKFindController.m    2011-02-18 10:47:30 UTC (rev 7112)
@@ -47,13 +47,19 @@
 @synthesize findField, ignoreCaseCheckbox, ownerController, labelField, 
buttons, findString, ignoreCase;
 @dynamic findOptions, target, selectionSource;
 
+static SKFindController *sharedFindController = nil;
+
 + (id)sharedFindController {
-    static SKFindController *sharedFindController = nil;
     if (sharedFindController == nil)
         sharedFindController = [[self alloc] init];
     return sharedFindController;
 }
 
++ (id)allocWithZone:(NSZone *)zone {
+    if (sharedFindController) NSLog(@"Attempt to allocate second instance of 
%@", self);
+    return [super allocWithZone:zone];
+}
+
 - (id)init {
     if (self = [super initWithWindowNibName:@"FindPanel"]) {
         ignoreCase = YES;

Modified: trunk/SKImageToolTipWindow.m
===================================================================
--- trunk/SKImageToolTipWindow.m        2011-02-16 13:33:26 UTC (rev 7111)
+++ trunk/SKImageToolTipWindow.m        2011-02-18 10:47:30 UTC (rev 7112)
@@ -52,13 +52,19 @@
 
 @synthesize currentImageContext=context;
 
+static SKImageToolTipWindow *sharedToolTipWindow = nil;
+
 + (id)sharedToolTipWindow {
-    static SKImageToolTipWindow *sharedToolTipWindow = nil;
     if (sharedToolTipWindow == nil)
         sharedToolTipWindow = [[self alloc] init];
     return sharedToolTipWindow;
 }
 
++ (id)allocWithZone:(NSZone *)zone {
+    if (sharedToolTipWindow) NSLog(@"Attempt to allocate second instance of 
%@", self);
+    return [super allocWithZone:zone];
+}
+
 - (id)init {
     if (self = [super initWithContentRect:NSZeroRect]) {
         [self setHidesOnDeactivate:NO];

Modified: trunk/SKInfoWindowController.m
===================================================================
--- trunk/SKInfoWindowController.m      2011-02-16 13:33:26 UTC (rev 7111)
+++ trunk/SKInfoWindowController.m      2011-02-18 10:47:30 UTC (rev 7112)
@@ -80,13 +80,19 @@
     [transformer release];
 }
 
+static SKInfoWindowController *sharedInstance = nil;
+
 + (id)sharedInstance {
-    static SKInfoWindowController *sharedInstance = nil;
     if (sharedInstance == nil)
         sharedInstance = [[self alloc] init];
     return sharedInstance;
 }
 
++ (id)allocWithZone:(NSZone *)zone {
+    if (sharedInstance) NSLog(@"Attempt to allocate second instance of %@", 
self);
+    return [super allocWithZone:zone];
+}
+
 - (id)init {
     if (self = [super initWithWindowNibName:@"InfoWindow"]){
         info = nil;

Modified: trunk/SKLineInspector.m
===================================================================
--- trunk/SKLineInspector.m     2011-02-16 13:33:26 UTC (rev 7111)
+++ trunk/SKLineInspector.m     2011-02-18 10:47:30 UTC (rev 7112)
@@ -70,6 +70,11 @@
     return sharedLineInspector != nil;
 }
 
++ (id)allocWithZone:(NSZone *)zone {
+    if (sharedLineInspector) NSLog(@"Attempt to allocate second instance of 
%@", self);
+    return [super allocWithZone:zone];
+}
+
 - (id)init {
     if (self = [super initWithWindowNibName:@"LineInspector"]) {
         style = kPDFBorderStyleSolid;

Modified: trunk/SKNotesPanelController.m
===================================================================
--- trunk/SKNotesPanelController.m      2011-02-16 13:33:26 UTC (rev 7111)
+++ trunk/SKNotesPanelController.m      2011-02-18 10:47:30 UTC (rev 7112)
@@ -56,6 +56,11 @@
     return sharedController != nil;
 }
 
++ (id)allocWithZone:(NSZone *)zone {
+    if (sharedController) NSLog(@"Attempt to allocate second instance of %@", 
self);
+    return [super allocWithZone:zone];
+}
+
 - (id)init {
     return (self = [super initWithWindowNibName:@"NotesPanel"]);
 }

Modified: trunk/SKPreferenceController.m
===================================================================
--- trunk/SKPreferenceController.m      2011-02-16 13:33:26 UTC (rev 7111)
+++ trunk/SKPreferenceController.m      2011-02-18 10:47:30 UTC (rev 7112)
@@ -60,13 +60,19 @@
 
 @synthesize contentView, resetButtons;
 
+static SKPreferenceController *sharedPrefenceController = nil;
+
 + (id)sharedPrefenceController {
-    static SKPreferenceController *sharedPrefenceController = nil;
     if (sharedPrefenceController == nil)
         sharedPrefenceController = [[self alloc] init];
     return sharedPrefenceController;
 }
 
++ (id)allocWithZone:(NSZone *)zone {
+    if (sharedPrefenceController) NSLog(@"Attempt to allocate second instance 
of %@", self);
+    return [super allocWithZone:zone];
+}
+
 - (id)init {
     if (self = [super initWithWindowNibName:@"PreferenceWindow"]) {
         preferencePanes = [[NSArray alloc] initWithObjects:

Modified: trunk/SKReleaseNotesController.m
===================================================================
--- trunk/SKReleaseNotesController.m    2011-02-16 13:33:26 UTC (rev 7111)
+++ trunk/SKReleaseNotesController.m    2011-02-18 10:47:30 UTC (rev 7112)
@@ -43,13 +43,19 @@
 
 @synthesize textView;
 
+static SKReleaseNotesController *sharedReleaseNotesController = nil;
+
 + (id)sharedReleaseNotesController {
-    static SKReleaseNotesController *sharedReleaseNotesController = nil;
     if (sharedReleaseNotesController == nil)
         sharedReleaseNotesController = [[self alloc] init];
     return sharedReleaseNotesController;
 }
 
++ (id)allocWithZone:(NSZone *)zone {
+    if (sharedReleaseNotesController) NSLog(@"Attempt to allocate second 
instance of %@", self);
+    return [super allocWithZone:zone];
+}
+
 - (id)init {
     return (self = [super initWithWindowNibName:@"ReleaseNotes"]);
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to