Revision: 16290
          http://sourceforge.net/p/skim-app/code/16290
Author:   hofman
Date:     2026-05-12 15:29:16 +0000 (Tue, 12 May 2026)
Log Message:
-----------
create rowHeights mapTable lazily

Modified Paths:
--------------
    trunk/SKNoteOutlineView.m

Modified: trunk/SKNoteOutlineView.m
===================================================================
--- trunk/SKNoteOutlineView.m   2026-05-12 14:54:52 UTC (rev 16289)
+++ trunk/SKNoteOutlineView.m   2026-05-12 15:29:16 UTC (rev 16290)
@@ -97,21 +97,22 @@
         }
         
         [[self headerView] setMenu:menu];
-        
-        rowHeights = [[NSMapTable alloc] 
initWithKeyOptions:NSPointerFunctionsStrongMemory | 
NSPointerFunctionsObjectPersonality valueOptions:NSPointerFunctionsOpaqueMemory 
| NSPointerFunctionsIntegerPersonality capacity:0];
     }
     return self;
 }
 
 - (CGFloat)rowHeightForItem:(id)item {
-    return (NSInteger)NSMapGet(rowHeights, (__bridge void *)item);
+    return rowHeights ? (NSInteger)NSMapGet(rowHeights, (__bridge void *)item) 
: 0.0;
 }
 
 - (void)setRowHeight:(CGFloat)rowHeight forItem:(id)item {
-    if (rowHeight > 0.0)
+    if (rowHeight > 0.0) {
+        if (rowHeights == nil)
+            rowHeights = [[NSMapTable alloc] 
initWithKeyOptions:NSPointerFunctionsStrongMemory | 
NSPointerFunctionsObjectPersonality valueOptions:NSPointerFunctionsOpaqueMemory 
| NSPointerFunctionsIntegerPersonality capacity:0];
         NSMapInsert(rowHeights, (__bridge void *)item, (void 
*)(NSInteger)rowHeight);
-    else
+    } else if (rowHeights) {
         NSMapRemove(rowHeights, (__bridge void *)item);
+    }
 }
 
 - (void)resetRowHeights {

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to