Fix memory leak.
This commit is contained in:
@@ -6,6 +6,7 @@ static NSTextView *text;
|
|||||||
|
|
||||||
void MakeNewCocoaWindow()
|
void MakeNewCocoaWindow()
|
||||||
{
|
{
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
NSImage *image = [NSImage imageNamed:@"splash"];
|
NSImage *image = [NSImage imageNamed:@"splash"];
|
||||||
NSImageView *iView;
|
NSImageView *iView;
|
||||||
NSView *view;
|
NSView *view;
|
||||||
@@ -46,19 +47,26 @@ void MakeNewCocoaWindow()
|
|||||||
[text display];
|
[text display];
|
||||||
|
|
||||||
[window makeKeyAndOrderFront:nil];
|
[window makeKeyAndOrderFront:nil];
|
||||||
|
[pool release];
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisposeOfCocoaWindow()
|
void DisposeOfCocoaWindow()
|
||||||
{
|
{
|
||||||
|
// Just in case
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
[window close]; /* Released by setReleasedWhenClosed */
|
[window close]; /* Released by setReleasedWhenClosed */
|
||||||
|
[pool release];
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCocoaWindowText(const char *s)
|
void SetCocoaWindowText(const char *s)
|
||||||
{
|
{
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
NSString *str = [NSString stringWithUTF8String:s];
|
NSString *str = [NSString stringWithUTF8String:s];
|
||||||
|
|
||||||
[text setString:(str ? str : @"" )];
|
[text setString:(str ? str : @"" )];
|
||||||
[text display];
|
[text display];
|
||||||
|
[pool release];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user