Revision: 27874
http://sourceforge.net/p/bibdesk/svn/27874
Author: hofman
Date: 2022-09-08 09:51:33 +0000 (Thu, 08 Sep 2022)
Log Message:
-----------
set retrieving flag in main thread client object
Modified Paths:
--------------
trunk/bibdesk/BDSKSharingClient.h
trunk/bibdesk/BDSKSharingClient.m
Modified: trunk/bibdesk/BDSKSharingClient.h
===================================================================
--- trunk/bibdesk/BDSKSharingClient.h 2022-09-08 06:30:17 UTC (rev 27873)
+++ trunk/bibdesk/BDSKSharingClient.h 2022-09-08 09:51:33 UTC (rev 27874)
@@ -46,6 +46,7 @@
NSData *archivedPublications;
NSData *archivedMacros;
BOOL needsUpdate;
+ BOOL isRetrieving;
NSString *name;
BDSKAsyncSharingClient *asyncClient;
}
Modified: trunk/bibdesk/BDSKSharingClient.m
===================================================================
--- trunk/bibdesk/BDSKSharingClient.m 2022-09-08 06:30:17 UTC (rev 27873)
+++ trunk/bibdesk/BDSKSharingClient.m 2022-09-08 09:51:33 UTC (rev 27874)
@@ -46,7 +46,6 @@
static NSString *BDSKClientServiceNameForKeychain = @"BibDesk Sharing Access";
typedef struct _BDSKSharingClientFlags {
- _Atomic(BOOL) isRetrieving;
_Atomic(BOOL) authenticationFailed;
_Atomic(BOOL) canceledAuthentication;
_Atomic(BOOL) needsAuthentication;
@@ -68,7 +67,6 @@
- (id)initWithClient:(BDSKSharingClient *)aClient andService:(NSNetService
*)aService;
-@property (getter=isRetrieving) BOOL retrieving;
@property (readonly) BOOL needsAuthentication;
@property (readonly) BOOL authenticationFailed;
@property (readonly) BOOL failedDownload;
@@ -82,6 +80,8 @@
@interface BDSKSharingClient ()
+@property (nonatomic, getter=isRetrieving) BOOL retrieving;
+
@property (nonatomic, retain) NSData *archivedPublications;
@property (nonatomic, retain) NSData *archivedMacros;
@@ -91,8 +91,8 @@
@implementation BDSKSharingClient
-@synthesize needsUpdate, archivedPublications, archivedMacros, name;
-@dynamic retrieving, failedDownload, needsAuthentication,
authenticationFailed, errorMessage;
+@synthesize needsUpdate, retrieving, archivedPublications, archivedMacros,
name;
+@dynamic failedDownload, needsAuthentication, authenticationFailed,
errorMessage;
#pragma mark Init and dealloc
@@ -127,6 +127,7 @@
}
- (void)retrievePublications {
+ [self setRetrieving:YES];
[asyncClient performSelectorOnLocalThread:@selector(retrievePublications)
withObject:nil waitUntilDone:NO];
}
@@ -137,15 +138,11 @@
[self setNeedsUpdate:NO];
// we need to do this after setting the archivedPublications but before
sending the notification
- [asyncClient setRetrieving:NO];
+ [self setRetrieving:NO];
[[NSNotificationCenter defaultCenter]
postNotificationName:BDSKSharingClientUpdatedNotification object:self];
}
-- (BOOL)isRetrieving {
- return (BOOL)[asyncClient isRetrieving];
-}
-
- (BOOL)failedDownload {
return [asyncClient failedDownload];
}
@@ -169,7 +166,7 @@
@implementation BDSKAsyncSharingClient
@synthesize errorMessage;
-@dynamic retrieving, needsAuthentication, authenticationFailed, failedDownload;
+@dynamic needsAuthentication, authenticationFailed, failedDownload;
// If we introduce incompatible changes in future, bump this to avoid sharing
breakage
// Note we should always support -invalidate, as this can be called when we're
not accepted
@@ -223,14 +220,6 @@
[client setNeedsUpdate:flag];
}
-- (BOOL)isRetrieving {
- return atomic_load(&flags.isRetrieving) == YES;
-}
-
-- (void)setRetrieving:(BOOL)flag {
- atomic_store(&flags.isRetrieving, flag);
-}
-
- (BOOL)needsAuthentication {
return atomic_load(&flags.needsAuthentication) == YES;
}
@@ -487,7 +476,6 @@
- (oneway void)retrievePublications;
{
// set so we don't try calling this multiple times
- atomic_store(&flags.isRetrieving, YES);
atomic_store(&flags.failedDownload, NO);
NSAutoreleasePool *pool = [NSAutoreleasePool new];
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