We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 458 - Crash toggling fullscreen mode on Mac OS X
Summary: Crash toggling fullscreen mode on Mac OS X
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 1.2.11
Hardware: x86 Mac OS X 10.4 (Intel)
: P2 major
Assignee: Christian Walther
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-13 22:40 UTC by Sam Lantinga
Modified: 2007-07-23 21:21 UTC (History)
2 users (show)

See Also:


Attachments
Fix for some Cocoa memory management problems. (1.88 KB, patch)
2007-07-23 01:10 UTC, Christian Walther
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Lantinga 2007-07-13 22:40:20 UTC
I'm getting a crash related to event delivery in Objective C with these steps:
1. run testwm
2. press alt-enter
Comment 1 Sam Lantinga 2007-07-13 22:48:03 UTC
I'm looking at this.  It appears to have something to do with the window being destroyed and recreated.  It's better with the Cider patch, but still crashes after a window -> fullscreen -> window cycle.

I'm going to try to create the window once and simply reuse it for each video mode.
Comment 2 Sam Lantinga 2007-07-14 00:04:18 UTC
That's not going to work, since we need to be able to recreate the window.

I did notice a crash in NSView that went away when I commented out [window_view release]
Hmm...
Comment 3 Sam Lantinga 2007-07-15 10:29:23 UTC
Christian, can you take a quick look at this one?  If you can't figure it out, it can wait until the next patch release since it's been active for over a year without anyone reporting as far as I can tell.

You'll probably need to remote debug it, since it involves a crash toggling fullscreen mode.
Comment 4 Christian Walther 2007-07-15 21:57:31 UTC
I'll have a look, but probably not before tomorrow.
Comment 5 Sam Lantinga 2007-07-15 22:05:11 UTC
Okay, thanks.

I'll start working on packaging, getting everything ready to go for release, but it'll be probably a day or three before everything is put together.
Comment 6 Christian Walther 2007-07-16 12:59:03 UTC
So far I've come up with the following, but it seems we're not done with that yet. I still get a crash originating from [qz_window close] when switching to fullscreen the second time (with NSZombie enabled, it can be caught by breaking on -[_NSZombie forward::]).

--- src/video/quartz/SDL_QuartzVideo.m  (revision 3292)
+++ src/video/quartz/SDL_QuartzVideo.m  (working copy)
@@ -369,8 +369,7 @@
         
         /* If we still have a valid window, close it. */
         if ( qz_window ) {
-            [ qz_window close ];
-            [ qz_window release ];
+            [ qz_window close ]; /* includes release because [qz_window isReleasedWhenClosed] */
             qz_window = nil;
             window_view = nil;
         }
@@ -399,8 +398,7 @@
     /* Release window mode resources */
     else {
         
-        [ qz_window close ];
-        [ qz_window release ];
+        [ qz_window close ]; /* includes release because [qz_window isReleasedWhenClosed] */
         qz_window = nil;
         window_view = nil;

Plus another strange thing is that when moving the mouse for the first time after switching to fullscreen, the cursor leaves behind a black square with a white right and bottom border.
Comment 7 Christian Walther 2007-07-23 01:10:30 UTC
Created attachment 231 [details]
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.

About the cursor issue I mentioned in the last message, I think I'll leave that to someone who has any actual interest in 8 bit mode...
Comment 8 Sam Lantinga 2007-07-23 21:21:39 UTC
Thanks, this looks great!  I've checked it in with subversion revision 3380.
We can enter another bug for the cursor issue.