Skip to content

Commit

Permalink
Fixed bug #458
Browse files Browse the repository at this point in the history
------- Comment #7 From Christian Walther 2007-07-23 01:10:30 [reply] -------
Fix for some Cocoa memory management problems.

OK, I think I've nailed the memory management problems with the attached patch.
Too late for the release, but oh well. It shows that I haven't done much Cocoa
lately... took me a while to figure out that NSWindows don't retain their
delegate.
  • Loading branch information
slouken committed Jul 24, 2007
1 parent 9e5963f commit 07f3d8d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/video/quartz/SDL_QuartzVideo.m
Expand Up @@ -369,8 +369,8 @@ static void QZ_UnsetVideoMode (_THIS, BOOL to_desktop) {

/* If we still have a valid window, close it. */
if ( qz_window ) {
[ qz_window close ];
[ qz_window release ];
NSCAssert([ qz_window delegate ] == nil, @"full screen window shouldn't have a delegate"); /* if that should ever change, we'd have to release it here */
[ qz_window close ]; /* includes release because [qz_window isReleasedWhenClosed] */
qz_window = nil;
window_view = nil;
}
Expand Down Expand Up @@ -398,9 +398,9 @@ static void QZ_UnsetVideoMode (_THIS, BOOL to_desktop) {
}
/* Release window mode resources */
else {

[ qz_window close ];
[ qz_window release ];
id delegate = [ qz_window delegate ];
[ qz_window close ]; /* includes release because [qz_window isReleasedWhenClosed] */
if (delegate != nil) [ delegate release ];
qz_window = nil;
window_view = nil;

Expand Down Expand Up @@ -747,15 +747,15 @@ other blitting while waiting on the VBL (and hence results in higher framerates)
return NULL;
}

/*[ qz_window setReleasedWhenClosed:YES ];*/
/*[ qz_window setReleasedWhenClosed:YES ];*/ /* no need to set this as it's the default for NSWindows */
QZ_SetCaption(this, this->wm_title, this->wm_icon);
[ qz_window setAcceptsMouseMovedEvents:YES ];
[ qz_window setViewsNeedDisplay:NO ];
if ( center_window ) {
[ qz_window center ];
}
[ qz_window setDelegate:
[ [ [ SDL_QuartzWindowDelegate alloc ] init ] autorelease ] ];
[ [ SDL_QuartzWindowDelegate alloc ] init ] ];
[ qz_window setContentView: [ [ [ SDL_QuartzView alloc ] init ] autorelease ] ];
}
/* We already have a window, just change its size */
Expand Down

0 comments on commit 07f3d8d

Please sign in to comment.