]> granicus.if.org Git - handbrake/commitdiff
MacGui: fixed a number of memory leaks. Do not set some deprecated hb_job fields.
authorritsuka <damiog@gmail.com>
Mon, 22 Dec 2014 07:30:12 +0000 (07:30 +0000)
committerritsuka <damiog@gmail.com>
Mon, 22 Dec 2014 07:30:12 +0000 (07:30 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6637 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.m
macosx/HBAudioController.m
macosx/HBJob.m
macosx/HBSubtitlesController.m
macosx/HBTitle.m

index 86e85df43ab56faab8ec8d8a5f11e189270d82b7..efbcdb74c7dadf90b112fd927c4493269f169327 100644 (file)
@@ -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);
index 1f9a1207e84b79b40e2ed6319d4547c31e850ef4..bc2b6e45dbf9fdc16b2887722397bd52b29b2496 100644 (file)
@@ -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;
     }
index 946f24997e1a44305274ce66de1d982d82ae7560..7449524019f53e1b28d640985efecb39095809d7 100644 (file)
                                                                                                            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
  */
     }
 
     // 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;
 
     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];
     // 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);
index 5c0ab53224c193e9e458de3eb3a6a54fef525dfb..05eafa537d22870e79f27184a549fc7575e8b8c6 100644 (file)
@@ -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;
index 989d963057ea268c5b38341defd18561e611b36a..20c985691000e8f5e744c05be01cf824304254c2 100644 (file)
@@ -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)