1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-21 23:32:35 +00:00

Merge pull request #3950 from Coeur/coeur/modalDelegateDeprecated

Fix 'modalDelegate:' is deprecated to avoid contextInfo leaks.
This commit is contained in:
Mitch Livingston 2022-10-13 07:54:07 -04:00 committed by GitHub
commit 20c2fde7ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 19 deletions

View file

@ -80,8 +80,7 @@ AboutWindowController* fAboutBoxInstance = nil;
- (IBAction)hideLicense:(id)sender
{
[self.fLicenseSheet orderOut:nil];
[NSApp endSheet:self.fLicenseSheet];
[self.window endSheet:self.fLicenseSheet];
}
@end

View file

@ -90,16 +90,14 @@ BlocklistDownloaderViewController* fBLViewController = nil;
- (void)setFinished
{
[NSApp endSheet:self.fStatusWindow];
[self.fStatusWindow orderOut:self];
[self.fPrefsController.window endSheet:self.fStatusWindow];
fBLViewController = nil;
}
- (void)setFailed:(NSString*)error
{
[NSApp endSheet:self.fStatusWindow];
[self.fStatusWindow orderOut:self];
[self.fPrefsController.window endSheet:self.fStatusWindow];
NSAlert* alert = [[NSAlert alloc] init];
[alert addButtonWithTitle:NSLocalizedString(@"OK", "Blocklist -> button")];
@ -109,8 +107,6 @@ BlocklistDownloaderViewController* fBLViewController = nil;
alert.informativeText = error;
[alert beginSheetModalForWindow:self.fPrefsController.window completionHandler:^(NSModalResponse returnCode) {
[alert.window orderOut:self];
fBLViewController = nil;
}];
}

View file

@ -687,7 +687,6 @@ NSMutableSet* creatorWindowControllerSet = nil;
alert.informativeText = [NSString stringWithFormat:@"%s (%d)", error->message, error->code];
[alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) {
[alert.window orderOut:nil];
[self.window close];
}];
tr_error_free(error);

View file

@ -58,10 +58,11 @@ typedef void (^CompletionBlock)(BOOL);
modalForWindow:(NSWindow*)window
completionHandler:(void (^)(BOOL))completionHandler
{
// we capture renamer strongly to avoid it being deallocated before completionHandler
__block FileRenameSheetController* strongRenamer = renamer;
[window beginSheet:renamer.window completionHandler:^(NSModalResponse returnCode) {
completionHandler(returnCode == NSModalResponseOK);
[renamer.window orderOut:self];
strongRenamer = nil;
}];
}

View file

@ -295,8 +295,7 @@
- (IBAction)cancelRules:(id)sender
{
[self.groupRulesSheetWindow orderOut:nil];
[NSApp endSheet:self.groupRulesSheetWindow];
[self.fTableView.window endSheet:self.groupRulesSheetWindow];
NSInteger index = [GroupsController.groups indexForRow:self.fTableView.selectedRow];
if (![GroupsController.groups autoAssignRulesForIndex:index])
@ -309,8 +308,7 @@
- (IBAction)saveRules:(id)sender
{
[self.groupRulesSheetWindow orderOut:nil];
[NSApp endSheet:self.groupRulesSheetWindow];
[self.fTableView.window endSheet:self.groupRulesSheetWindow];
NSInteger index = [GroupsController.groups indexForRow:self.fTableView.selectedRow];
[GroupsController.groups setUsesAutoAssignRules:YES forIndex:index];

View file

@ -159,8 +159,6 @@ tr_session* fLib = NULL;
alert.showsSuppressionButton = YES;
[alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) {
[alert.window orderOut:nil];
if (alert.suppressionButton.state == NSControlStateValueOn)
{
[NSUserDefaults.standardUserDefaults setBool:NO forKey:@"WarningResetStats"];

View file

@ -68,13 +68,11 @@ NSString* urlString = nil;
- (void)openURLEndSheet:(id)sender
{
[self.window orderOut:sender];
[NSApp endSheet:self.window returnCode:1];
}
- (void)openURLCancelEndSheet:(id)sender
{
[self.window orderOut:sender];
[NSApp endSheet:self.window returnCode:0];
}