Revision: 29637
          http://sourceforge.net/p/bibdesk/svn/29637
Author:   hofman
Date:     2025-09-28 15:06:42 +0000 (Sun, 28 Sep 2025)
Log Message:
-----------
don't retain notes search index, autorelease to be sure because it uses a lock 
so resetting may come in between (or not?)

Modified Paths:
--------------
    trunk/bibdesk/BDSKNotesSearchIndex.h
    trunk/bibdesk/BDSKNotesSearchIndex.m
    trunk/bibdesk/BibDocument_Search.m

Modified: trunk/bibdesk/BDSKNotesSearchIndex.h
===================================================================
--- trunk/bibdesk/BDSKNotesSearchIndex.h        2025-09-28 14:40:25 UTC (rev 
29636)
+++ trunk/bibdesk/BDSKNotesSearchIndex.h        2025-09-28 15:06:42 UTC (rev 
29637)
@@ -65,7 +65,7 @@
 - (void)resetWithPublications:(nullable NSArray *)pubs;
 
 // Warning:  it is /not/ safe to write to this SKIndexRef directly; use it 
only for reading.
-@property (nonatomic, readonly) SKIndexRef copyIndex;
+@property (nonatomic, readonly) SKIndexRef index NS_RETURNS_INNER_POINTER;
 
 // call when closing the document window; kills the search and prevents 
further callbacks
 - (void)terminate;

Modified: trunk/bibdesk/BDSKNotesSearchIndex.m
===================================================================
--- trunk/bibdesk/BDSKNotesSearchIndex.m        2025-09-28 14:40:25 UTC (rev 
29636)
+++ trunk/bibdesk/BDSKNotesSearchIndex.m        2025-09-28 15:06:42 UTC (rev 
29637)
@@ -57,7 +57,7 @@
 @implementation BDSKNotesSearchIndex
 
 @synthesize delegate;
-@dynamic copyIndex;
+@dynamic index;
 
 - (instancetype)initForOwner:(id <BDSKOwner>)owner
 {
@@ -191,7 +191,7 @@
 }
 
 
-- (SKIndexRef)copyIndex
+- (SKIndexRef)index
 {
     if (terminated)
         return NULL;
@@ -204,7 +204,7 @@
         SKIndexFlush(theIndex);
         atomic_store(&needsFlushing, NO);
     }
-    return theIndex;
+    return (SKIndexRef)CFAutorelease(theIndex);
 }
 
 - (void)indexItemForIdentifierURL:(NSURL *)identifierURL fileURLs:(NSArray 
*)fileURLs removeEmpty:(BOOL)removeEmpty

Modified: trunk/bibdesk/BibDocument_Search.m
===================================================================
--- trunk/bibdesk/BibDocument_Search.m  2025-09-28 14:40:25 UTC (rev 29636)
+++ trunk/bibdesk/BibDocument_Search.m  2025-09-28 15:06:42 UTC (rev 29637)
@@ -196,7 +196,7 @@
             
             // we need the correct search index
             if ([field isEqualToString:BDSKSkimNotesString])
-                skIndex = [notesSearchIndex copyIndex];
+                skIndex = [notesSearchIndex index];
             else if ([self hasGroupTypeSelected:BDSKExternalGroupType])
                 skIndex = [[[[self selectedGroups] firstObject] publications] 
indexForField:field];
             else
@@ -484,9 +484,8 @@
 
 - (void)notesSearchIndexDidUpdate:(BDSKNotesSearchIndex *)searchIndex {
     if ([self displaysControlView:BDSKControlViewSearch] && [[searchButtonBar 
selectedIdentifier] isEqualToString:BDSKSkimNotesString]) {
-        SKIndexRef skIndex = [notesSearchIndex copyIndex];
+        SKIndexRef skIndex = [notesSearchIndex index];
         [documentSearch 
searchForString:BDSKSearchKitExpressionWithString([searchField stringValue]) 
index:skIndex selectedPublications:[self selectedPublications] 
scrollPositionAsPercentage:[tableView scrollPositionAsPercentage]];
-        CFRelease(skIndex);
     }
 }
 

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