Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Use a small function to release UIScreenMode after checking it is sup…
…ported
  • Loading branch information
keestux committed Oct 18, 2011
1 parent c1e71e0 commit 68666d645d0bd2fda9f428d1348822bdf01d1d4e
Showing with 16 additions and 6 deletions.
  1. +16 −6 src/video/uikit/SDL_uikitvideo.m
@@ -242,6 +242,19 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
return 0;
}

static void
UIKit_ReleaseUIScreenMode(SDL_DisplayMode * mode)
{
if (!SDL_UIKit_supports_multiple_displays) {
// Not on at least iPhoneOS 3.2 (versions prior to iPad).
SDL_assert(mode->driverdata == NULL);
} else {
UIScreenMode *uimode = (UIScreenMode *) mode->driverdata;
[uimode release];
mode->driverdata = NULL;
}
}

void
UIKit_VideoQuit(_THIS)
{
@@ -252,14 +265,11 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
UIScreen *uiscreen = (UIScreen *) display->driverdata;
[uiscreen release];
display->driverdata = NULL;
[((UIScreenMode *) display->desktop_mode.driverdata) release];
display->desktop_mode.driverdata = NULL;
[((UIScreenMode *) display->current_mode.driverdata) release];
display->current_mode.driverdata = NULL;
UIKit_ReleaseUIScreenMode(&display->desktop_mode);
UIKit_ReleaseUIScreenMode(&display->current_mode);
for (j = 0; j < display->num_display_modes; j++) {
SDL_DisplayMode *mode = &display->display_modes[j];
[((UIScreenMode *) mode->driverdata) release];
mode->driverdata = NULL;
UIKit_ReleaseUIScreenMode(mode);
}
}
}

0 comments on commit 68666d6

Please sign in to comment.