Skip to content

Commit 04fdc46

Browse files
authored
Makes sure we stop the dispatch_source to prevent cycle/leak (#1161)
* Makes sure we stop the dispatch_source to prevent cycle/leak * reverts unnecessary change * test on 6s only
1 parent 447287a commit 04fdc46

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
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 & 3 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

Rakefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ namespace :test do
299299

300300
t.scheme = 'Parse-iOS'
301301
t.sdk = 'iphonesimulator'
302-
t.destinations = ["\"platform=iOS Simulator,OS=9.1,name=iPhone 4s\"",
303-
"\"platform=iOS Simulator,OS=9.1,name=iPhone 6s\"",]
302+
t.destinations = ["\"platform=iOS Simulator,OS=9.1,name=iPhone 6s\"",]
304303
t.configuration = 'Debug'
305304
t.additional_options = { "GCC_INSTRUMENT_PROGRAM_FLOW_ARCS" => "YES",
306305
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }

0 commit comments

Comments
 (0)