Revision: 13128
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=13128&view=rev
Author:   amaxwell
Date:     2008-04-08 13:22:48 -0700 (Tue, 08 Apr 2008)

Log Message:
-----------
Fix a leak; +sharedPreviewer was being called recursively before the static 
variable was initialized.  It should now be sufficiently reentrant.

Modified Paths:
--------------
    trunk/bibdesk/BDSKPreviewer.m

Modified: trunk/bibdesk/BDSKPreviewer.m
===================================================================
--- trunk/bibdesk/BDSKPreviewer.m       2008-04-08 14:53:37 UTC (rev 13127)
+++ trunk/bibdesk/BDSKPreviewer.m       2008-04-08 20:22:48 UTC (rev 13128)
@@ -88,9 +88,10 @@
 
 @implementation BDSKPreviewer
 
+static BDSKPreviewer *sharedPreviewer = nil;
+
 + (BDSKPreviewer *)sharedPreviewer{
-    static BDSKPreviewer *sharedPreviewer = nil;
-
+    
     if (sharedPreviewer == nil) {
         sharedPreviewer = [[self alloc] init];
     }
@@ -112,7 +113,8 @@
     return self;
 }
 
-- (BOOL)isSharedPreviewer { return [self isEqual:[[self class] 
sharedPreviewer]]; }
+// Using isEqual:[BDSKSharedPreviewer sharedPreviewer] will lead to a leak if 
awakeFromNib is called while +sharedPreviewer is on the stack for the first 
time, since it calls isSharedPreviewer.  This is readily seen from the 
backtrace in 
http://sourceforge.net/tracker/index.php?func=detail&aid=1936951&group_id=61487&atid=497423
 although it doesn't fix that problem.
+- (BOOL)isSharedPreviewer { return [self isEqual:sharedPreviewer]; }
 
 #pragma mark UI setup and display
 


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

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to