Revision: 29638
http://sourceforge.net/p/bibdesk/svn/29638
Author: hofman
Date: 2025-09-28 15:51:19 +0000 (Sun, 28 Sep 2025)
Log Message:
-----------
Go back to returning retained search indexes to avoid CFAutorelease, but don't
use copy in method name as that is misleading as we don't return a copy
Modified Paths:
--------------
trunk/bibdesk/BDSKItemSearchIndexes.h
trunk/bibdesk/BDSKItemSearchIndexes.m
trunk/bibdesk/BDSKNotesSearchIndex.h
trunk/bibdesk/BDSKNotesSearchIndex.m
trunk/bibdesk/BibDocument_Search.m
Modified: trunk/bibdesk/BDSKItemSearchIndexes.h
===================================================================
--- trunk/bibdesk/BDSKItemSearchIndexes.h 2025-09-28 15:06:42 UTC (rev
29637)
+++ trunk/bibdesk/BDSKItemSearchIndexes.h 2025-09-28 15:51:19 UTC (rev
29638)
@@ -49,7 +49,7 @@
- (void)removePublications:(NSArray *)pubs;
- (void)addPublications:(NSArray *)pubs;
-- (nullable SKIndexRef)indexForField:(NSString *)field
NS_RETURNS_INNER_POINTER;
+- (nullable SKIndexRef)indexForField:(NSString *)field CF_RETURNS_RETAINED;
- (void)reset;
Modified: trunk/bibdesk/BDSKItemSearchIndexes.m
===================================================================
--- trunk/bibdesk/BDSKItemSearchIndexes.m 2025-09-28 15:06:42 UTC (rev
29637)
+++ trunk/bibdesk/BDSKItemSearchIndexes.m 2025-09-28 15:51:19 UTC (rev
29638)
@@ -191,7 +191,7 @@
- (SKIndexRef)indexForField:(NSString *)field {
NSParameterAssert(nil != field);
- SKIndexRef anIndex = (SKIndexRef)CFDictionaryGetValue(searchIndexes,
(CFStringRef)field);
+ SKIndexRef anIndex =
(SKIndexRef)CFRetain(CFDictionaryGetValue(searchIndexes, (CFStringRef)field));
if (CFSetContainsValue(indexesToFlush, anIndex)) {
SKIndexFlush(anIndex);
CFSetRemoveValue(indexesToFlush, anIndex);
Modified: trunk/bibdesk/BDSKNotesSearchIndex.h
===================================================================
--- trunk/bibdesk/BDSKNotesSearchIndex.h 2025-09-28 15:06:42 UTC (rev
29637)
+++ trunk/bibdesk/BDSKNotesSearchIndex.h 2025-09-28 15:51:19 UTC (rev
29638)
@@ -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 index NS_RETURNS_INNER_POINTER;
+@property (nonatomic, readonly) SKIndexRef index CF_RETURNS_RETAINED;
// 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 15:06:42 UTC (rev
29637)
+++ trunk/bibdesk/BDSKNotesSearchIndex.m 2025-09-28 15:51:19 UTC (rev
29638)
@@ -204,7 +204,7 @@
SKIndexFlush(theIndex);
atomic_store(&needsFlushing, NO);
}
- return (SKIndexRef)CFAutorelease(theIndex);
+ return 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 15:06:42 UTC (rev 29637)
+++ trunk/bibdesk/BibDocument_Search.m 2025-09-28 15:51:19 UTC (rev 29638)
@@ -206,6 +206,7 @@
if (documentSearch == nil)
documentSearch = [[BDSKDocumentSearch alloc]
initWithDelegate:self];
[documentSearch
searchForString:BDSKSearchKitExpressionWithString(searchString) index:skIndex
selectedPublications:pubsToSelect scrollPositionAsPercentage:[tableView
scrollPositionAsPercentage]];
+ CFRelease(skIndex);
} else {
// the index can be nil when the external group has no
publications
[shownPublications removeAllObjects];
@@ -486,6 +487,7 @@
if ([self displaysControlView:BDSKControlViewSearch] && [[searchButtonBar
selectedIdentifier] isEqualToString:BDSKSkimNotesString]) {
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