Skip to content

Commit c3546fe

Browse files
committed
Makes sure we stop the dispatch_source to prevent cycle/leak
1 parent ba0afd1 commit c3546fe

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

Parse/Internal/PFEventuallyQueue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extern NSTimeInterval const PFEventuallyQueueDefaultTimeoutRetryInterval;
6767
- (void)start NS_REQUIRES_SUPER;
6868
- (void)resume NS_REQUIRES_SUPER;
6969
- (void)pause NS_REQUIRES_SUPER;
70-
70+
- (void)stop NS_REQUIRES_SUPER;
7171
- (void)removeAllCommands NS_REQUIRES_SUPER;
7272

7373
@end

Parse/Internal/PFEventuallyQueue.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ - (void)pause {
197197
dispatch_suspend(_processingQueueSource);
198198
}
199199

200+
- (void)stop {
201+
dispatch_source_cancel(_processingQueueSource);
202+
}
203+
200204
- (void)removeAllCommands {
201205
dispatch_sync(_synchronizationQueue, ^{
202206
[_taskCompletionSources removeAllObjects];

Parse/Internal/ParseManager.m

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,15 @@ - (PFEventuallyQueue *)eventuallyQueue {
174174
[PFPinningEventuallyQueue newDefaultPinningEventuallyQueueWithDataSource:self]
175175
:
176176
commandCache);
177-
178177
// We still need to clear out the old command cache even if we're using Pinning in case
179178
// anything is left over when the user upgraded. Checking number of pending and then
180179
// clearing should be enough.
181-
if (self.offlineStoreLoaded && commandCache.commandCount > 0) {
182-
[commandCache removeAllCommands];
180+
if (self.offlineStoreLoaded) {
181+
if (commandCache.commandCount > 0) {
182+
[commandCache removeAllCommands];
183+
}
184+
// we won't need it after stop everything...
185+
[commandCache stop];
183186
}
184187
}
185188
#endif
@@ -442,7 +445,6 @@ - (BFTask *)preloadDiskObjectsToMemoryAsync {
442445
#endif
443446
];
444447
[[BFTask taskForCompletionOfAllTasks:tasks] waitUntilFinished]; // Wait synchronously to make sure we are blocking preload queue.
445-
[self eventuallyQueue];
446448

447449
return nil;
448450
}];

0 commit comments

Comments
 (0)