src/video/cocoa/SDL_cocoavideo.m
changeset 6832 156e608ec4ef
parent 6788 036f53f2f5aa
child 6836 b0ca1571caf3
     1.1 --- a/src/video/cocoa/SDL_cocoavideo.m	Fri Feb 01 17:09:01 2013 -0800
     1.2 +++ b/src/video/cocoa/SDL_cocoavideo.m	Sun Jan 06 19:04:53 2013 +0300
     1.3 @@ -250,37 +250,36 @@
     1.4          }
     1.5      }
     1.6  
     1.7 -    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     1.8 +    @autoreleasepool {
     1.9 +        NSString *msg = [NSString stringWithFormat:
    1.10 +                @"Assertion failure at %s (%s:%d), triggered %u time%s:\n  '%s'",
    1.11 +                    data->function, data->filename, data->linenum,
    1.12 +                    data->trigger_count, (data->trigger_count == 1) ? "" : "s",
    1.13 +                    data->condition];
    1.14  
    1.15 -    NSString *msg = [NSString stringWithFormat:
    1.16 -            @"Assertion failure at %s (%s:%d), triggered %u time%s:\n  '%s'",
    1.17 -                data->function, data->filename, data->linenum,
    1.18 -                data->trigger_count, (data->trigger_count == 1) ? "" : "s",
    1.19 -                data->condition];
    1.20 +        NSLog(@"%@", msg);
    1.21  
    1.22 -    NSLog(@"%@", msg);
    1.23 +        /*
    1.24 +         * !!! FIXME: this code needs to deal with fullscreen modes:
    1.25 +         * !!! FIXME:  reset to default desktop, runModal, reset to current?
    1.26 +         */
    1.27  
    1.28 -    /*
    1.29 -     * !!! FIXME: this code needs to deal with fullscreen modes:
    1.30 -     * !!! FIXME:  reset to default desktop, runModal, reset to current?
    1.31 -     */
    1.32 +        NSAlert* alert = [[NSAlert alloc] init];
    1.33 +        [alert setAlertStyle:NSCriticalAlertStyle];
    1.34 +        [alert setMessageText:msg];
    1.35 +        [alert addButtonWithTitle:@"Retry"];
    1.36 +        [alert addButtonWithTitle:@"Break"];
    1.37 +        [alert addButtonWithTitle:@"Abort"];
    1.38 +        [alert addButtonWithTitle:@"Ignore"];
    1.39 +        [alert addButtonWithTitle:@"Always Ignore"];
    1.40 +        const NSInteger clicked = [alert runModal];
    1.41  
    1.42 -    NSAlert* alert = [[NSAlert alloc] init];
    1.43 -    [alert setAlertStyle:NSCriticalAlertStyle];
    1.44 -    [alert setMessageText:msg];
    1.45 -    [alert addButtonWithTitle:@"Retry"];
    1.46 -    [alert addButtonWithTitle:@"Break"];
    1.47 -    [alert addButtonWithTitle:@"Abort"];
    1.48 -    [alert addButtonWithTitle:@"Ignore"];
    1.49 -    [alert addButtonWithTitle:@"Always Ignore"];
    1.50 -    const NSInteger clicked = [alert runModal];
    1.51 -    [pool release];
    1.52 +        if (!initialized) {
    1.53 +            SDL_QuitSubSystem(SDL_INIT_VIDEO);
    1.54 +        }
    1.55  
    1.56 -    if (!initialized) {
    1.57 -        SDL_QuitSubSystem(SDL_INIT_VIDEO);
    1.58 +        return (SDL_assert_state) (clicked - NSAlertFirstButtonReturn);
    1.59      }
    1.60 -
    1.61 -    return (SDL_assert_state) (clicked - NSAlertFirstButtonReturn);
    1.62  }
    1.63  
    1.64  #endif /* SDL_VIDEO_DRIVER_COCOA */