diff options
author | ritsuka <[email protected]> | 2015-01-10 08:38:37 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2015-01-10 08:38:37 +0000 |
commit | 71e4a6fcb9389808a09d2f16598e9f554da7622c (patch) | |
tree | 21e30695359051bd41c6d684e3cfc87b33e49815 /macosx/HBOutputPanelController.m | |
parent | c15f3a20b256b97246ea6d63065d3374e0530f24 (diff) |
MacGui: fix a leak of the output log file path string.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6719 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBOutputPanelController.m')
-rw-r--r-- | macosx/HBOutputPanelController.m | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/macosx/HBOutputPanelController.m b/macosx/HBOutputPanelController.m index fd003b034..d924df80a 100644 --- a/macosx/HBOutputPanelController.m +++ b/macosx/HBOutputPanelController.m @@ -23,6 +23,21 @@ #define TextStorageLowerSizeLimit 120000 @interface HBOutputPanelController () <HBOutputRedirectListening> +{ + /// Textview that displays debug output. + IBOutlet NSTextView *textView; + + /// Text storage for the debug output. + NSTextStorage *outputTextStorage; + + /// Path to log text file. + NSString *outputLogFile; + BOOL encodeLogOn; +} + +/// Path to individual log text file. +@property (nonatomic, copy) NSString *outputLogFileForEncode; + @end @implementation HBOutputPanelController @@ -135,8 +150,7 @@ NSString *outputDateFileName = [NSString stringWithFormat:@"%@ %@.txt",[[outputFileForEncode lastPathComponent] stringByDeletingPathExtension],dateForLogTitle]; if ([[NSUserDefaults standardUserDefaults] boolForKey:@"EncodeLogLocation"]) // if we are putting it in the same directory with the movie { - - outputLogFileForEncode = [[NSString stringWithFormat:@"%@/%@",[outputFileForEncode stringByDeletingLastPathComponent],outputDateFileName] retain]; + self.outputLogFileForEncode = [NSString stringWithFormat:@"%@/%@",[outputFileForEncode stringByDeletingLastPathComponent], outputDateFileName]; } else // if we are putting it in the default ~/Libraries/Application Support/HandBrake/EncodeLogs logs directory { @@ -148,14 +162,14 @@ attributes:nil error:nil]; } - outputLogFileForEncode = [[NSString stringWithFormat:@"%@/%@",encodeLogDirectory,outputDateFileName] retain]; + self.outputLogFileForEncode = [NSString stringWithFormat:@"%@/%@",encodeLogDirectory,outputDateFileName]; } - [fileManager createFileAtPath:outputLogFileForEncode contents:nil attributes:nil]; + [fileManager createFileAtPath:self.outputLogFileForEncode contents:nil attributes:nil]; /* Similar to the regular activity log, we print a header containing the date and time of the encode as well as what directory it was encoded to */ NSString *versionStringFull = [[NSString stringWithFormat: @"Handbrake Version: %@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]] stringByAppendingString: [NSString stringWithFormat: @" (%@)\n\n", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]]; NSString *startOutputLogString = [NSString stringWithFormat: @"HandBrake Activity Log for %@: %@\n%@",outputFileForEncode, [[NSDate date] descriptionWithCalendarFormat:nil timeZone:nil locale:nil],versionStringFull]; - [startOutputLogString writeToFile:outputLogFileForEncode atomically:YES encoding:NSUTF8StringEncoding error:NULL]; + [startOutputLogString writeToFile:self.outputLogFileForEncode atomically:YES encoding:NSUTF8StringEncoding error:NULL]; } @@ -189,9 +203,9 @@ fprintf(f, "%s", [text UTF8String]); fclose(f); - if (encodeLogOn == YES && outputLogFileForEncode != nil) + if (encodeLogOn == YES && self.outputLogFileForEncode != nil) { - FILE *e = fopen([outputLogFileForEncode UTF8String], "a"); + FILE *e = fopen([self.outputLogFileForEncode UTF8String], "a"); fprintf(e, "%s", [text UTF8String]); fclose(e); } |