Ignore:
Timestamp:
06/15/09 23:02:41 (15 years ago)
Author:
Nicholas Riley
Message:

Don't keep QTMovies around (and corresponding files open) for pending alarms; we could run out of file handles this way.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/PSMovieAlert.m

    r543 r544  
    77//
    88
     9#import <QTKit/QTKit.h>
    910#import <QuickTime/Movies.h>
    1011#import "PSMovieAlert.h"
     
    3536        alias = [anAlias retain];
    3637        repetitions = numReps;
    37         // XXX if we support remote movie URLs, need to call EnterMovies() ourselves at least in Jaguar (_MacTech_ December 2002, p. 64); also should do async movie loading (p. 73Ð74).
    38         movie = [[QTMovie alloc] initWithFile: path error: NULL];
     38        QTMovie *movie = [[QTMovie alloc] initWithFile: path error: NULL];
    3939        if (movie == nil) {
    4040            [self release];
     
    4848            }
    4949        }
     50        [movie release];
    5051    }
    5152   
     
    6566- (QTMovie *)movie;
    6667{
    67     return movie;
     68    NSString *path = [alias fullPath];
     69    if (path == nil)
     70        return nil;
     71   
     72    return [[[QTMovie alloc] initWithFile: path error: NULL] autorelease];
    6873}
    6974
     
    8186{
    8287    [alias release];
    83     [movie release];
     88
     89    NSLog(@"PSMovieAlert dealloc: %@", self);
    8490    [super dealloc];
    8591}
     
    8793- (NSString *)description;
    8894{
    89     return [NSString stringWithFormat: @"PSMovieAlert (%@%@): %@, repeats %hu times%@", hasAudio ? @"A" : @"", hasVideo ? @"V" : @"", [alias fullPath], repetitions, hasAudio && outputVolume != kNoVolume ? [NSString stringWithFormat: @" at %.0f%% volume", outputVolume * 100] : @""];
     95    return [NSString stringWithFormat: @"PSMovieAlert (%@%@): %@, repeats %hu times%@", hasAudio ? @"A" : @"", hasVideo ? @"V" : @"", [alias fullPath], repetitions, hasAudio && outputVolume != PSMediaAlertNoVolume ? [NSString stringWithFormat: @" at %.0f%% volume", outputVolume * 100] : @""];
    9096}
    9197
     
    97103- (NSAttributedString *)actionDescription;
    98104{
    99     BOOL isStatic = [movie NJR_isStatic];
     105    BOOL isStatic = [[self movie] NJR_isStatic];
    100106    NSMutableAttributedString *string = [[(isStatic ? @"Show " : @"Play ") small] mutableCopy];
    101107    NSString *kindString = nil, *name = [alias displayNameWithKindString: &kindString];
Note: See TracChangeset for help on using the changeset viewer.