Skip to content

Commit e9e7c83

Browse files
committed
Merge recent improvements from branch 'FrozenForMacOS10.10'
2 parents b680efa + 7bd22f8 commit e9e7c83

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

SSYAlert.h

+9
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,15 @@ extern NSObject <SSYAlertErrorHideManager> * gSSYAlertErrorHideManager ;
710710
If the error returns a -localizedFailureReason, presents that in the smallText
711711
following a localized label "Possible reason for Error:".
712712
713+
If the error contains a SSYHelpUrlErrorKey in its info dictionary, presents a
714+
help button which upon being clicked opens that Help URL in the user's default
715+
web browser.
716+
717+
If the error returns a -helpAnchor and does not contain a SSYHelpUrlErrorKey
718+
in its info dictionary, presents a help button which upon being clicked
719+
opens that help anchor in the app's Help Book. If both the SSYHelpUrlErrorKey
720+
and -helpAnchor are present in the error, the latter is ignored.
721+
713722
If the error returns a -localizedRecoverySuggestion, presents that in the small text
714723
folowing a localized label "Suggestion to Fix this Error:".
715724

SSYAlert.m

+29-2
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,25 @@ - (void)stealObjectsFromAppleAlerts {
857857

858858
// Steal the icon. (Could also get this from NSBundle I suppose.)
859859
NSImage* rawIcon = [nsAlert icon] ;
860+
861+
/* The next line was added to fix a crash during subsequent app quitting
862+
which started in macOS 12:
863+
* Assertion failed: (![[NSApp _openWindows] NS_containsObjectIdenticalTo:self]), function -[NSWindow dealloc], file NSWindow.m, line 1579
864+
I only noticed this if I quit after licensing. After licensing, there
865+
are two SSYAlert objects created and destroyed in succession. The first
866+
one shows the downloaded License Information and the second one I forgot
867+
what it shows. Anyhow, I noticted that if I quit the app immediately
868+
after dismissing those two SSYAlerts in succession, the array returned by
869+
[NSApplication windows] included two _NSAlertPanel which I found were
870+
attached to the `nsAlert` created here. Even after the fix, these two
871+
_NSAlertPanel objects remain in [NSApplication windows] for some time, but
872+
will be found to be gone later if you do not quit immediately. Although
873+
sending either -close or -performClose: fixed the assertion+crash, I
874+
decided on the former since the latter calls NSBeep, probably because
875+
the "window doesn’t have a close button", as explained in documentation
876+
of -[NSWindow performClose:]. */
877+
[nsAlert.window close];
878+
860879
#if !__has_feature(objc_arc)
861880
[nsAlert release] ;
862881
#endif
@@ -2403,14 +2422,22 @@ - (void)doLayoutError:(NSError*)error {
24032422
[self setTitleText:title] ;
24042423
}
24052424

2406-
// Set Help Anchor
2425+
// Set Help Anchor if given by help anchor
24072426
{
24082427
NSString* helpAddress = [error helpAnchor] ;
24092428
if (helpAddress) {
24102429
[self setHelpAddress:helpAddress] ;
24112430
}
24122431
}
2413-
2432+
2433+
// Set Help Anchor if given by help URL (may override helpAnchor)
2434+
{
2435+
NSURL* helpUrl = [[error userInfo] objectForKey:SSYHelpUrlErrorKey] ;
2436+
if (helpUrl) {
2437+
[self setHelpAddress:helpUrl.absoluteString] ;
2438+
}
2439+
}
2440+
24142441
// Set smallText
24152442
[self setSmallText:[error localizedDeepDescription]] ;
24162443

SSYOperationQueue.m

+6-2
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,12 @@ - (void)observeValueForKeyPath:(NSString*)keyPath
239239
240240
Sorry, on 20200601, again while running the Safari/run.sh test
241241
AppleScript, it crashed again. So I increased the sleep time
242-
to 2. */
243-
sleep(2);
242+
to 2.
243+
244+
Sorry, on 202103XX, again while running the Safari/run.sh test
245+
AppleScript, it crashed again. So I increased the sleep time
246+
to 5. */
247+
sleep(5);
244248
[scriptCommand resumeExecutionWithResult:[self scriptResult]] ;
245249
[self setScriptCommand:nil] ;
246250
}

SSYShortcutBackEnd.m

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,4 @@ - (void)shortcutRecorder:(SRRecorderControl*)aRecorder
4242
selectorName:[self selectorName]] ;
4343
}
4444

45-
46-
@end
45+
@end

0 commit comments

Comments
 (0)