Revision: 24123
          http://sourceforge.net/p/bibdesk/svn/24123
Author:   hofman
Date:     2019-08-11 22:03:14 +0000 (Sun, 11 Aug 2019)
Log Message:
-----------
fix hash and isEqual for lazily generated colors

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

Modified: trunk/bibdesk/NSColor_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSColor_BDSKExtensions.m      2019-08-11 21:44:35 UTC (rev 
24122)
+++ trunk/bibdesk/NSColor_BDSKExtensions.m      2019-08-11 22:03:14 UTC (rev 
24123)
@@ -397,12 +397,14 @@
 - (BOOL)isEqual:(id)other {
     if ([other isMemberOfClass:[self class]] == NO)
         return NO;
-    if (aquaColor == nil || darkAquaColor == nil || ((BDSKDynamicColor 
*)other)->aquaColor == nil || ((BDSKDynamicColor *)other)->darkAquaColor)
-        return NO;
+    if (colorGenerator || ((BDSKDynamicColor *)other)->colorGenerator)
+        return self == other;
     return [aquaColor isEqual:((BDSKDynamicColor *)other)->aquaColor] && 
[darkAquaColor isEqual:((BDSKDynamicColor *)other)->darkAquaColor];
 }
 
 - (NSUInteger)hash {
+    if (colorGenerator)
+        return [super hash];
     return [aquaColor hash] + 31 * [darkAquaColor hash];
 }
 

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



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to