Skip to content
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

[TIMOB-26344] (7_3_X) iOS: Pass blocks with copy to retain them properly #10298

Merged
merged 1 commit into from
Sep 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions iphone/Classes/TiApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceAppl
- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[self tryToInvokeSelector:@selector(application:performFetchWithCompletionHandler:)
withArguments:[NSOrderedSet orderedSetWithObjects:application, completionHandler, nil]];
withArguments:[NSOrderedSet orderedSetWithObjects:application, [completionHandler copy], nil]];

//Only for simulator builds
NSArray *backgroundModes = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"];
Expand Down Expand Up @@ -647,7 +647,7 @@ - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSS
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler
{
[self tryToInvokeSelector:@selector(application:handleActionWithIdentifier:forRemoteNotification:completionHandler:)
withArguments:[NSOrderedSet orderedSetWithObjects:application, identifier, userInfo, completionHandler, nil]];
withArguments:[NSOrderedSet orderedSetWithObjects:application, identifier, userInfo, [completionHandler copy], nil]];

[self handleRemoteNotificationWithIdentifier:identifier
andUserInfo:userInfo
Expand Down Expand Up @@ -678,7 +678,7 @@ - (void)application:(UIApplication *)application
}

[self tryToInvokeSelector:@selector(application:handleWatchKitExtensionRequest:reply:)
withArguments:[NSOrderedSet orderedSetWithObjects:application, userInfo, reply, nil]];
withArguments:[NSOrderedSet orderedSetWithObjects:application, userInfo, [reply copy], nil]];

[[NSNotificationCenter defaultCenter] postNotificationName:kTiWatchKitExtensionRequest object:self userInfo:dic];
}
Expand Down Expand Up @@ -730,7 +730,7 @@ - (void)tryToInvokeSelector:(SEL)selector withArguments:(NSOrderedSet<id> *)argu
[self invokeSelector:selector withArguments:arguments onDelegate:applicationDelegate];
}
}
} else {
} else if (!appBooted && _applicationDelegates == nil) {
[[self queuedApplicationSelectors] setObject:arguments forKey:selectorString];
}
}
Expand Down Expand Up @@ -836,7 +836,7 @@ - (void)application:(UIApplication *)application didReceiveRemoteNotification:(N
}

[self tryToInvokeSelector:@selector(application:didReceiveRemoteNotification:fetchCompletionHandler:)
withArguments:[NSOrderedSet orderedSetWithObjects:application, userInfo, completionHandler, nil]];
withArguments:[NSOrderedSet orderedSetWithObjects:application, userInfo, [completionHandler copy], nil]];

//This only here for Simulator builds.

Expand Down Expand Up @@ -882,7 +882,7 @@ - (void)application:(UIApplication *)application handleEventsForBackgroundURLSes
[backgroundTransferCompletionHandlers setObject:[[completionHandler copy] autorelease] forKey:key];

[self tryToInvokeSelector:@selector(application:handleEventsForBackgroundURLSession:completionHandler:)
withArguments:[NSOrderedSet orderedSetWithObjects:application, identifier, completionHandler, nil]];
withArguments:[NSOrderedSet orderedSetWithObjects:application, identifier, [completionHandler copy], nil]];

NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:identifier, @"sessionId",
key, @"handlerId", nil];
Expand Down Expand Up @@ -1230,7 +1230,7 @@ - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserAct
[launchOptions setObject:userActivityDict forKey:UIApplicationLaunchOptionsUserActivityDictionaryKey];

[self tryToInvokeSelector:@selector(application:continueUserActivity:restorationHandler:)
withArguments:[NSOrderedSet orderedSetWithObjects:application, userActivity, restorationHandler, nil]];
withArguments:[NSOrderedSet orderedSetWithObjects:application, userActivity, [restorationHandler copy], nil]];

if (appBooted) {
[[NSNotificationCenter defaultCenter] postNotificationName:kTiContinueActivity object:self userInfo:dict];
Expand Down Expand Up @@ -1488,7 +1488,7 @@ - (void)application:(UIApplication *)application
completionHandler:(void (^)(BOOL succeeded))completionHandler
{
[self tryToInvokeSelector:@selector(application:performActionForShortcutItem:completionHandler:)
withArguments:[NSOrderedSet orderedSetWithObjects:application, shortcutItem, completionHandler, nil]];
withArguments:[NSOrderedSet orderedSetWithObjects:application, shortcutItem, [completionHandler copy], nil]];

BOOL handledShortCutItem = [self handleShortcutItem:shortcutItem queueToBootIfNotLaunched:NO];
completionHandler(handledShortCutItem);
Expand Down