Skip to content

Commit ac1d6e3

Browse files
committed
• Fixed NSWindow memory management error in SSYAlert.
1 parent 7770a8b commit ac1d6e3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

SSYAlert.m

+6-3
Original file line numberDiff line numberDiff line change
@@ -2176,6 +2176,12 @@ - (id)init {
21762176
styleMask:NSTitledWindowMask
21772177
backing:NSBackingStoreBuffered
21782178
defer:NO] ;
2179+
/* NSWindow has nonstandard memory management. Note that, under non-ARC,
2180+
we do *not* release this alloc-initted 'window', and the static analyzer
2181+
does not complain about this! If we do [window release], then the static
2182+
analyzer does not complain either (!!), but we get a runtime crash when
2183+
this window is autoreleased! Read comments in my project NSWindowLifer,
2184+
or maybe I will blog about this. */
21792185
NSString* appName = [[NSBundle mainAppBundle] objectForInfoDictionaryKey:@"CFBundleName"] ; // CFBundleName may be localized
21802186
if (appName) {
21812187
[window setTitle:appName] ;
@@ -2187,9 +2193,6 @@ - (id)init {
21872193

21882194
// Invoke designated initializer for super, NSWindowController
21892195
self = [super initWithWindow:window] ;
2190-
#if !__has_feature(objc_arc)
2191-
[window release] ;
2192-
#endif
21932196

21942197
if (self) {
21952198
[self stealObjectsFromAppleAlerts] ;

0 commit comments

Comments
 (0)