Minor bug in Quartz video driver

I’ve been starting to play around with SDL for a couple weeks now in
preparation for making a small OpenGL game. When running on OS X, I
noticed in a small sample project that it was trying to free a
non-malloced address. This problem was not apparent on other

I eventually traced it to SDL_FreeSurface(), where surface->pixels is
released. Specifically, it happens when calling SDL_Quit() when using
a windowed opengl context after leaving a fullscreen opengl context.
The Quartz video driver sets the pixel buffer in question at
SDL_QuartzVideo.m:468. This buffer can’t be released, because it
points to some system buffer (I assume) returned by

If SDL_Quit() is called during a fullscreen context, the surface
apparently isn’t released because it’s the SDL_VideoSurface. When
switching to a windowed opengl context, the pixels buffer is never
pointed elsewhere.

NULL when creating a windowed opengl surface (when creating a windowed
non-opengl surface, current->pixels is already explicitly set). I have
no idea if this is right, since I really don’t know much about the
video subsystem, especially anything that relates to the 2D drawing

Index: SDL_QuartzVideo.mFrom my understanding, this can be fixed by adding a current->pixels =

RCS file:
retrieving revision 1.31
diff --context=3 -r1.31 SDL_QuartzVideo.m
*** SDL_QuartzVideo.m 10 Aug 2003 07:21:43 -0000 1.31
— SDL_QuartzVideo.m 16 Nov 2003 04:28:40 -0000

*** 705,710 ****
— 705,711 ----
[ gl_context makeCurrentContext];
[ qz_window makeKeyAndOrderFront:nil ];
current->flags |= SDL_OPENGL;

  •     current->pixels = NULL;
     /* For 2D, we set the subview to an NSQuickDrawView */
     else {

What is the difference between SDL_VideoSurface and SDL_PublicSurface.
Is it documented someplace what they are for, and when they should be

I also noticed that the QZ_SetVideoMode() returns the same surface,
except modified. I assume the driver could choose to create an
entirely new surface object every time, or is it expected that it be
the same (if so, when is prev_mode released in SDL_SetVideoMode())?

Richard Schreyer