Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Base.lproj/SplashWindow.xib
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Welcome to Add Folder Icons" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" visibleAtLaunch="NO" animationBehavior="default" id="1">
<window title="Welcome to Add Folder Icons" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="1">
<windowStyleMask key="styleMask" titled="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="800" height="500"/>
Expand Down
22 changes: 21 additions & 1 deletion SplashWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ - ( void ) windowDidLoad
{
[ super windowDidLoad ];

/* The main window's NIB sets "released when closed" to NO, but the splash
* window's NIB does not, so the splash window defaults to releasing itself
* on close. On modern macOS that is fatal: when the splash window is the
* key window and is closed, it is deallocated, yet AppKit's automatic
* focus-ring machinery still references it when first-responder status
* moves back to the main window. The result is a use-after-free crash in
* +[_NSAutomaticFocusRing _clearOldFocusRing] -> -[NSWindow
* _setNeedsDisplayInRegion:]. This controller owns the window for the
* lifetime of the application, so keep it alive on close, matching the
* behaviour already configured for the main window.
*/

[ [ self window ] setReleasedWhenClosed: NO ];

[ [ self window ] center ];
[ [ self window ] makeKeyAndOrderFront: nil ];
}
Expand All @@ -65,7 +79,13 @@ - ( void ) windowDidLoad
- ( IBAction ) closeWindow: ( NSButton * ) sender
{
( void ) sender;
[ self close ];

/* Resign first responder before the window goes away so that AppKit tears
* down any focus ring while the window is still a valid object.
*/

[ [ self window ] makeFirstResponder: nil ];
[ self close ];
}

@end