Skip to content

Makes sure we stop the dispatch_source to prevent cycle/leak #1161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Parse/Internal/PFEventuallyQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extern NSTimeInterval const PFEventuallyQueueDefaultTimeoutRetryInterval;
- (void)start NS_REQUIRES_SUPER;
- (void)resume NS_REQUIRES_SUPER;
- (void)pause NS_REQUIRES_SUPER;

- (void)stop NS_REQUIRES_SUPER;
- (void)removeAllCommands NS_REQUIRES_SUPER;

@end
Expand Down
4 changes: 4 additions & 0 deletions Parse/Internal/PFEventuallyQueue.m
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ - (void)pause {
dispatch_suspend(_processingQueueSource);
}

- (void)stop {
dispatch_source_cancel(_processingQueueSource);
}

- (void)removeAllCommands {
dispatch_sync(_synchronizationQueue, ^{
[_taskCompletionSources removeAllObjects];
Expand Down
9 changes: 6 additions & 3 deletions Parse/Internal/ParseManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,15 @@ - (PFEventuallyQueue *)eventuallyQueue {
[PFPinningEventuallyQueue newDefaultPinningEventuallyQueueWithDataSource:self]
:
commandCache);

// We still need to clear out the old command cache even if we're using Pinning in case
// anything is left over when the user upgraded. Checking number of pending and then
// clearing should be enough.
if (self.offlineStoreLoaded && commandCache.commandCount > 0) {
[commandCache removeAllCommands];
if (self.offlineStoreLoaded) {
if (commandCache.commandCount > 0) {
[commandCache removeAllCommands];
}
// we won't need it after stop everything...
[commandCache stop];
}
}
#endif
Expand Down
3 changes: 1 addition & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ namespace :test do

t.scheme = 'Parse-iOS'
t.sdk = 'iphonesimulator'
t.destinations = ["\"platform=iOS Simulator,OS=9.1,name=iPhone 4s\"",
"\"platform=iOS Simulator,OS=9.1,name=iPhone 6s\"",]
t.destinations = ["\"platform=iOS Simulator,OS=9.1,name=iPhone 6s\"",]
t.configuration = 'Debug'
t.additional_options = { "GCC_INSTRUMENT_PROGRAM_FLOW_ARCS" => "YES",
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }
Expand Down