Created
June 25, 2018 13:38
-
-
Save tomblench/82f493fe0bb377caa42372249a4c6f72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/CDTDatastore/query/CDTDatastore+Query.m b/CDTDatastore/query/CDTDatastore+Query.m | |
index 3ca9beb..a3ee2a2 100644 | |
--- a/CDTDatastore/query/CDTDatastore+Query.m | |
+++ b/CDTDatastore/query/CDTDatastore+Query.m | |
@@ -31,7 +31,7 @@ | |
// constructed. This association is cleared in | |
// [CDTQIndexManager dealloc]. | |
objc_setAssociatedObject(self, @selector(CDTQManager), m, | |
- OBJC_ASSOCIATION_ASSIGN); | |
+ OBJC_ASSOCIATION_RETAIN); | |
} | |
} | |
diff --git a/CDTDatastore/query/CDTQIndexManager.h b/CDTDatastore/query/CDTQIndexManager.h | |
index 12d5158..6d69f1e 100644 | |
--- a/CDTDatastore/query/CDTQIndexManager.h | |
+++ b/CDTDatastore/query/CDTQIndexManager.h | |
@@ -85,7 +85,7 @@ typedef NS_ENUM(NSInteger, CDTQQueryError) { | |
*/ | |
@interface CDTQIndexManager : NSObject | |
-@property (nonatomic, strong) CDTDatastore *datastore; | |
+@property (nonatomic, weak) CDTDatastore *datastore; | |
@property (nonatomic, strong) FMDatabaseQueue *database; | |
@property (nonatomic, readonly, getter = isTextSearchEnabled) BOOL textSearchEnabled; | |
diff --git a/CDTDatastore/query/CDTQIndexManager.m b/CDTDatastore/query/CDTQIndexManager.m | |
index 2f9fe38..28fffa0 100644 | |
--- a/CDTDatastore/query/CDTQIndexManager.m | |
+++ b/CDTDatastore/query/CDTQIndexManager.m | |
@@ -128,10 +128,6 @@ static const int VERSION = 2; | |
{ | |
// close the database. | |
[self.database close]; | |
- // remove the datastore's association with us, otherwise it will | |
- // become invalid since it's a weak reference | |
- objc_setAssociatedObject(self.datastore, @selector(CDTQManager), nil, | |
- OBJC_ASSOCIATION_ASSIGN); | |
} | |
#pragma mark List indexes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment