diff options
author | ritsuka <[email protected]> | 2014-12-22 07:30:12 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-12-22 07:30:12 +0000 |
commit | 546f57a1402492f2aedeab1ca6cf9f3d3201795f (patch) | |
tree | f34dcfe06110e8411db490c807385983a2d87457 | |
parent | f258fb8da28967d8f2e2ddaf814233058197044f (diff) |
MacGui: fixed a number of memory leaks. Do not set some deprecated hb_job fields.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6637 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | macosx/Controller.m | 23 | ||||
-rw-r--r-- | macosx/HBAudioController.m | 5 | ||||
-rw-r--r-- | macosx/HBJob.m | 37 | ||||
-rw-r--r-- | macosx/HBSubtitlesController.m | 4 | ||||
-rw-r--r-- | macosx/HBTitle.m | 9 |
5 files changed, 43 insertions, 35 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m index 86e85df43..efbcdb74c 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -1442,7 +1442,6 @@ NSString *keyContainerTag = @"keyContainerTag"; self.selectedPreset = [self createPresetFromCurrentSettings]; } - self.job = nil; // Notify anyone interested (audio/subtitles/chapters controller) that there's no title fPictureController.picture = nil; fPictureController.filters = nil; @@ -1453,6 +1452,8 @@ NSString *keyContainerTag = @"keyContainerTag"; fVideoController.video = nil; fChapterTitlesController.job = nil; + self.job = nil; + [self enableUI: NO]; NSError *outError = NULL; @@ -2578,21 +2579,9 @@ static void queueFSEventStreamCallback( } /* Picture Size Settings */ - job->width = [[queueToApply objectForKey:@"PictureWidth"] intValue]; - job->height = [[queueToApply objectForKey:@"PictureHeight"] intValue]; - - job->anamorphic.keep_display_aspect = [[queueToApply objectForKey:@"PictureKeepRatio"] intValue]; - job->anamorphic.mode = [[queueToApply objectForKey:@"PicturePAR"] intValue]; - job->modulus = [[queueToApply objectForKey:@"PictureModulus"] intValue]; job->par.num = [[queueToApply objectForKey:@"PicturePARPixelWidth"] intValue]; job->par.den = [[queueToApply objectForKey:@"PicturePARPixelHeight"] intValue]; - /* Here we use the crop values saved at the time the preset was saved */ - job->crop[0] = [[queueToApply objectForKey:@"PictureTopCrop"] intValue]; - job->crop[1] = [[queueToApply objectForKey:@"PictureBottomCrop"] intValue]; - job->crop[2] = [[queueToApply objectForKey:@"PictureLeftCrop"] intValue]; - job->crop[3] = [[queueToApply objectForKey:@"PictureRightCrop"] intValue]; - /* Video settings */ /* Framerate */ int fps_mode, fps_num, fps_den; @@ -2904,11 +2893,11 @@ static void queueFSEventStreamCallback( } /* Add Crop/Scale filter */ - filter = hb_filter_init( HB_FILTER_CROP_SCALE ); + filter = hb_filter_init(HB_FILTER_CROP_SCALE); hb_add_filter( job, filter, [[NSString stringWithFormat:@"%d:%d:%d:%d:%d:%d", - job->width, job->height, - job->crop[0], job->crop[1], - job->crop[2], job->crop[3]] UTF8String] ); + [queueToApply[@"PictureWidth"] intValue], [queueToApply[@"PictureHeight"] intValue], + [queueToApply[@"PictureTopCrop"] intValue], [queueToApply[@"PictureBottomCrop"] intValue], + [queueToApply[@"PictureLeftCrop"] intValue], [queueToApply[@"PictureRightCrop"] intValue]] UTF8String] ); /* Add framerate shaping filter */ filter = hb_filter_init(HB_FILTER_VFR); diff --git a/macosx/HBAudioController.m b/macosx/HBAudioController.m index 1f9a1207e..bc2b6e45d 100644 --- a/macosx/HBAudioController.m +++ b/macosx/HBAudioController.m @@ -494,7 +494,8 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification"; if (job) { - audioArray = job.audioTracks; + [audioArray release]; + audioArray = [job.audioTracks retain]; self.settings = job.audioDefaults; // Reinitialize the master list of available audio tracks from this title @@ -510,6 +511,8 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification"; } else { + [audioArray release]; + audioArray = nil; self.settings = nil; self.masterTrackArray = nil; } diff --git a/macosx/HBJob.m b/macosx/HBJob.m index 946f24997..744952401 100644 --- a/macosx/HBJob.m +++ b/macosx/HBJob.m @@ -50,6 +50,22 @@ withObject:preset.content]; } +- (void)dealloc +{ + [_audioTracks release]; + [_subtitlesTracks release]; + + [_video release]; + [_picture release]; + [_filters release]; + + [_audioDefaults release]; + [_subtitlesDefaults release]; + [_fileURL release]; + + [super dealloc]; +} + /** * Prepares a hb_job_t */ @@ -195,21 +211,9 @@ } // Picture Size Settings - job->width = self.picture.width; - job->height = self.picture.height; - - job->anamorphic.keep_display_aspect = self.picture.keepDisplayAspect; - job->anamorphic.mode = self.picture.anamorphicMode; - job->modulus = self.picture.modulus; job->par.num = self.picture.parWidth; job->par.den = self.picture.parHeight; - // Here we use the crop values saved at the time the preset was saved - job->crop[0] = self.picture.cropTop; - job->crop[1] = self.picture.cropBottom; - job->crop[2] = self.picture.cropLeft; - job->crop[3] = self.picture.cropRight; - // Video settings // Framerate int fps_mode, fps_num, fps_den; @@ -268,6 +272,9 @@ for (NSDictionary *subtitleDict in self.subtitlesTracks) { + if (i == self.subtitlesTracks.count - 1) + continue; + int subtitle = [subtitleDict[keySubTrackIndex] intValue]; int force = [subtitleDict[keySubTrackForced] intValue]; int burned = [subtitleDict[keySubTrackBurned] intValue]; @@ -551,9 +558,9 @@ // Add Crop/Scale filter filter = hb_filter_init(HB_FILTER_CROP_SCALE); hb_add_filter( job, filter, [NSString stringWithFormat:@"%d:%d:%d:%d:%d:%d", - job->width, job->height, - job->crop[0], job->crop[1], - job->crop[2], job->crop[3]].UTF8String); + self.picture.width, self.picture.height, + self.picture.cropTop, self.picture.cropBottom, + self.picture.cropLeft, self.picture.cropRight].UTF8String); // Add framerate shaping filter filter = hb_filter_init(HB_FILTER_VFR); diff --git a/macosx/HBSubtitlesController.m b/macosx/HBSubtitlesController.m index 5c0ab5322..05eafa537 100644 --- a/macosx/HBSubtitlesController.m +++ b/macosx/HBSubtitlesController.m @@ -43,8 +43,8 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex"; @property (assign) IBOutlet NSButton *reloadDefaults; // Subtitles arrays -@property (nonatomic, readwrite) NSMutableArray *subtitleArray; -@property (nonatomic, readwrite) NSMutableArray *subtitleSourceArray; +@property (nonatomic, readwrite, retain) NSMutableArray *subtitleArray; +@property (nonatomic, readwrite, retain) NSMutableArray *subtitleSourceArray; @property (nonatomic, readwrite, retain) NSString *foreignAudioSearchTrackName; @property (nonatomic, readwrite) int container; diff --git a/macosx/HBTitle.m b/macosx/HBTitle.m index 989d96305..20c985691 100644 --- a/macosx/HBTitle.m +++ b/macosx/HBTitle.m @@ -61,6 +61,15 @@ extern NSString *keySubTrackSrtCharCode; return self; } +- (void)dealloc +{ + [_name release]; + [_audioTracks release]; + [_subtitlesTracks release]; + [_chapters release]; + + [super dealloc]; +} - (NSString *)name { if (!_name) |