Revision: 28574
http://sourceforge.net/p/bibdesk/svn/28574
Author: hofman
Date: 2024-01-07 17:48:27 +0000 (Sun, 07 Jan 2024)
Log Message:
-----------
keep generated notification key as CFStringref
Modified Paths:
--------------
trunk/bibdesk/BDSKSharingServer.m
trunk/bibdesk/Bibdesk_Prefix.pch
Modified: trunk/bibdesk/BDSKSharingServer.m
===================================================================
--- trunk/bibdesk/BDSKSharingServer.m 2024-01-07 17:26:39 UTC (rev 28573)
+++ trunk/bibdesk/BDSKSharingServer.m 2024-01-07 17:48:27 UTC (rev 28574)
@@ -75,7 +75,7 @@
NSString *BDSKSharedArchivedMacroDataKey = @"macros_v1";
NSString *BDSKComputerNameChangedNotification =
@"BDSKComputerNameChangedNotification";
-NSString *BDSKComputerNameChangedKey = nil;
+CFStringRef BDSKComputerNameChangedKey = NULL;
NSString *BDSKServiceNameForKeychain = @"BibDesk Sharing";
@@ -85,10 +85,10 @@
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
CFIndex cnt = CFArrayGetCount(changedKeys);
- NSString *key;
+ CFStringRef key;
while(cnt--){
- key = (__bridge id)CFArrayGetValueAtIndex(changedKeys, cnt);
- if ([key isEqualToString:BDSKComputerNameChangedKey])
+ key = CFArrayGetValueAtIndex(changedKeys, cnt);
+ if (key && BDSKComputerNameChangedKey && CFEqual(key,
BDSKComputerNameChangedKey))
BDSKENSURE_MAIN_THREAD( [[NSNotificationCenter defaultCenter]
postNotificationName:BDSKComputerNameChangedNotification object:nil]; );
}
[pool release];
@@ -186,15 +186,12 @@
CFRunLoopAddSource(CFRunLoopGetCurrent(), rlSource,
kCFRunLoopCommonModes);
CFRelease(rlSource);
- CFMutableArrayRef keys = CFArrayCreateMutable(alloc, 0,
&kCFTypeArrayCallBacks);
+ // use SCDynamicStore keys as NSNotification names; don't release them
+ BDSKComputerNameChangedKey =
SCDynamicStoreKeyCreateComputerName(alloc);
- // use SCDynamicStore keys as NSNotification names; don't release them
- CFStringRef key = SCDynamicStoreKeyCreateComputerName(alloc);
- CFArrayAppendValue(keys, key);
- BDSKComputerNameChangedKey = (NSString *)key;
-
- BDSKASSERT(BDSKComputerNameChangedKey);
+ BDSKASSERT(BDSKComputerNameChangedKey != NULL);
+ CFArrayRef keys = CFArrayCreate(kCFAllocatorDefault, (const
void**)&BDSKComputerNameChangedKey, 1, &kCFTypeArrayCallBacks);
if(SCDynamicStoreSetNotificationKeys(dynamicStore, keys, NULL) ==
FALSE)
fprintf(stderr, "unable to register for dynamic store
notifications.\n");
CFRelease(keys);
Modified: trunk/bibdesk/Bibdesk_Prefix.pch
===================================================================
--- trunk/bibdesk/Bibdesk_Prefix.pch 2024-01-07 17:26:39 UTC (rev 28573)
+++ trunk/bibdesk/Bibdesk_Prefix.pch 2024-01-07 17:48:27 UTC (rev 28574)
@@ -74,6 +74,6 @@
} \
} while (0)
- #define BDSKDESTROY(variable) do { [variable release]; variable = nil; }
while (0)
+ #define BDSKDESTROY(variable) variable = nil
#endif
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