Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Commit

Permalink
[#449] use weak NSHashTable for lists of observers
Browse files Browse the repository at this point in the history
  • Loading branch information
mackuba committed Mar 30, 2015
1 parent 28b7ee2 commit a339f1c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Hive/Backend/BCClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ @interface BCClient () {

@property (nonatomic, assign) uint64 availableBalance;
@property (nonatomic, assign) uint64 estimatedBalance;
@property (nonatomic, strong, readonly) NSMutableSet *transactionObservers;
@property (nonatomic, strong, readonly) NSHashTable *transactionObservers;

@end

Expand Down Expand Up @@ -80,7 +80,7 @@ - (instancetype)initWithBaseURL:(NSURL *)URL {
});
};

_transactionObservers = [NSMutableSet new];
_transactionObservers = [NSHashTable weakObjectsHashTable];

if (DEBUG_OPTION_ENABLED(TESTING_NETWORK)) {
bitcoin.testingNetwork = YES;
Expand Down
4 changes: 2 additions & 2 deletions Hive/Backend/HIExchangeRateService.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ @interface HIExchangeRateService () {
}

@property (nonatomic, strong) AFHTTPClient *client;
@property (nonatomic, strong) NSMutableSet *observers;
@property (nonatomic, strong) NSHashTable *observers;
@property (nonatomic, strong) NSMutableDictionary *exchangeRates;
@property (nonatomic, copy) NSDate *lastUpdate;

Expand All @@ -41,7 +41,7 @@ - (instancetype)init {

if (self) {
self.client = [BCClient sharedClient];
self.observers = [NSMutableSet new];
self.observers = [NSHashTable weakObjectsHashTable];
self.exchangeRates = [NSMutableDictionary new];
self.lastUpdate = [NSDate dateWithTimeIntervalSince1970:0];

Expand Down
4 changes: 2 additions & 2 deletions Hive/Backend/HINameFormatService.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@interface HINameFormatService()

@property (nonatomic, strong) NSMutableSet *observers;
@property (nonatomic, strong) NSHashTable *observers;

@end

Expand All @@ -28,7 +28,7 @@ - (id)init {
self = [super init];

if (self) {
_observers = [NSMutableSet new];
_observers = [NSHashTable weakObjectsHashTable];

[[NSUserDefaults standardUserDefaults] registerDefaults:@{ LastNameFirstDefaultsKey: @0 }];
[[NSUserDefaults standardUserDefaults] addObserver:self
Expand Down

0 comments on commit a339f1c

Please sign in to comment.