src/video/uikit/SDL_uikitvideo.m
changeset 5997 69875bbf83d8
parent 5558 dd0f52bf2bfa
child 6014 7a8b72b88d86
     1.1 --- a/src/video/uikit/SDL_uikitvideo.m	Sat Oct 15 23:50:06 2011 -0700
     1.2 +++ b/src/video/uikit/SDL_uikitvideo.m	Fri Oct 14 20:47:53 2011 -0400
     1.3 @@ -212,7 +212,8 @@
     1.4      mode.h = h;
     1.5      mode.refresh_rate = 0;
     1.6      
     1.7 -    [uimode retain];
     1.8 +    [uimode retain];  // once for the desktop_mode
     1.9 +    [uimode retain];  // once for the current_mode
    1.10      mode.driverdata = uimode;
    1.11  
    1.12      SDL_zero(display);
    1.13 @@ -286,13 +287,14 @@
    1.14          UIScreen *uiscreen = (UIScreen *) display->driverdata;
    1.15          [uiscreen release];
    1.16          display->driverdata = NULL;
    1.17 +        [((UIScreenMode *) display->desktop_mode.driverdata) release];
    1.18 +        display->desktop_mode.driverdata = NULL;
    1.19 +        [((UIScreenMode *) display->current_mode.driverdata) release];
    1.20 +        display->current_mode.driverdata = NULL;
    1.21          for (j = 0; j < display->num_display_modes; j++) {
    1.22              SDL_DisplayMode *mode = &display->display_modes[j];
    1.23 -            UIScreenMode *uimode = (UIScreenMode *) mode->driverdata;
    1.24 -            if (uimode) {
    1.25 -                [uimode release];
    1.26 -                mode->driverdata = NULL;
    1.27 -            }
    1.28 +            [((UIScreenMode *) mode->driverdata) release];
    1.29 +            mode->driverdata = NULL;
    1.30          }
    1.31      }
    1.32  }