mirror of
https://github.com/transmission/transmission
synced 2024-12-22 07:42:37 +00:00
Merge pull request #3950 from Coeur/coeur/modalDelegateDeprecated
Fix 'modalDelegate:' is deprecated to avoid contextInfo leaks.
This commit is contained in:
commit
20c2fde7ae
7 changed files with 8 additions and 19 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}];
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}];
|
||||
}
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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"];
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue