File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -40,11 +40,20 @@ - (nonnull instancetype)initWithFilename:(NSString *)filename
40
40
return self;
41
41
}
42
42
43
+ - (void ) dealloc {
44
+ if (self.pendingBlock ){
45
+ dispatch_block_cancel (self.pendingBlock );
46
+ }
47
+ }
48
+
43
49
- (void )performWrite : (void (^)(void ))writeBlock {
44
50
__weak PersistentEventStore *weakSelf = self;
45
51
dispatch_async (self.writeQueue , ^{
46
52
__strong PersistentEventStore *strongSelf = weakSelf;
47
- if (!strongSelf) return ; // Ensure strongSelf is not nil
53
+ if (!strongSelf) { // Ensure strongSelf is not nil
54
+ NRLOG_WARNING (@" A block was scheduled but PersistentEventStore was deallocated before running" );
55
+ return ;
56
+ }
48
57
49
58
if (strongSelf.pendingBlock != nil ) {
50
59
dispatch_block_cancel (strongSelf.pendingBlock );
You can’t perform that action at this time.
0 commit comments