From 5357fd1375d19a6c5de96293b3899f430422a3c0 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 20 Oct 2015 15:24:10 +0200 Subject: Replace a lot of SPBeginAlertSheet()s with the more concise SPOnewayAlertSheet() This should also eliminate a few use-after-free crashes --- Source/SPTextViewAdditions.m | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Source/SPTextViewAdditions.m') diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m index 56103a53..ef5c776e 100644 --- a/Source/SPTextViewAdditions.m +++ b/Source/SPTextViewAdditions.m @@ -653,8 +653,11 @@ if(inputFileError != nil) { NSString *errorMessage = [inputFileError localizedDescription]; - SPBeginAlertSheet(NSLocalizedString(@"Bundle Error", @"bundle error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self window], self, nil, nil, - [NSString stringWithFormat:@"%@ “%@”:\n%@", NSLocalizedString(@"Error for", @"error for message"), [cmdData objectForKey:@"name"], errorMessage]); + SPOnewayAlertSheet( + NSLocalizedString(@"Bundle Error", @"bundle error"), + [self window], + [NSString stringWithFormat:@"%@ “%@”:\n%@", NSLocalizedString(@"Error for", @"error for message"), [cmdData objectForKey:@"name"], errorMessage] + ); if (cmdData) [cmdData release]; return; } @@ -772,8 +775,11 @@ } } else if([err code] != 9) { // Suppress an error message if command was killed NSString *errorMessage = [err localizedDescription]; - SPBeginAlertSheet(NSLocalizedString(@"BASH Error", @"bash error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self window], self, nil, nil, - [NSString stringWithFormat:@"%@ “%@”:\n%@", NSLocalizedString(@"Error for", @"error for message"), [cmdData objectForKey:@"name"], errorMessage]); + SPOnewayAlertSheet( + NSLocalizedString(@"BASH Error", @"bash error"), + [self window], + [NSString stringWithFormat:@"%@ “%@”:\n%@", NSLocalizedString(@"Error for", @"error for message"), [cmdData objectForKey:@"name"], errorMessage] + ); } } -- cgit v1.2.3 From ffbf7a4a9d4c617afd47a5428a17e0646b9bce97 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 21 Oct 2015 00:39:34 +0200 Subject: Fix bundle commands no longer working in popup field editor (and possibly other cases) (#2299) Replacing some [NSApp mainWindow] with their actually intended calls [NSApp keyWindow] and [view window] --- Source/SPTextViewAdditions.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/SPTextViewAdditions.m') diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m index ef5c776e..88096a8f 100644 --- a/Source/SPTextViewAdditions.m +++ b/Source/SPTextViewAdditions.m @@ -849,7 +849,7 @@ if([keyEq length]) [mItem setKeyEquivalentModifierMask:[[[item objectForKey:SPBundleFileKeyEquivalentKey] objectAtIndex:1] intValue]]; - [mItem setTarget:[[NSApp mainWindow] firstResponder]]; + [mItem setTarget:[[NSApp keyWindow] firstResponder]]; if([item objectForKey:SPBundleFileTooltipKey]) [mItem setToolTip:[item objectForKey:SPBundleFileTooltipKey]]; -- cgit v1.2.3