summaryrefslogtreecommitdiffstats
path: root/macosx/HBQueueController.mm
diff options
context:
space:
mode:
authorritsuka <[email protected]>2013-10-15 11:36:51 +0000
committerritsuka <[email protected]>2013-10-15 11:36:51 +0000
commitedc929027efbdade94a7e1c895308df8d058086b (patch)
tree6a1dd18b796c22d827e525457095ab26d2b09269 /macosx/HBQueueController.mm
parent186685f0ab2f2db4e37d50e8291ef8997153d831 (diff)
MacGUI: fixed a number of leaks/null-deferences/dead-code found by clang static analyzer.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5838 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBQueueController.mm')
-rw-r--r--macosx/HBQueueController.mm80
1 files changed, 46 insertions, 34 deletions
diff --git a/macosx/HBQueueController.mm b/macosx/HBQueueController.mm
index 13e944e02..5fd1f050d 100644
--- a/macosx/HBQueueController.mm
+++ b/macosx/HBQueueController.mm
@@ -109,9 +109,11 @@ static NSString* HBQueuePauseResumeToolbarIdentifier = @"HBQueuePauseRe
nil]];
fJobGroups = [[NSMutableArray arrayWithCapacity:0] retain];
- }
- return self;
+ [self initStyles];
+ }
+
+ return self;
}
- (void)setQueueArray: (NSMutableArray *)QueueFileArray
@@ -211,6 +213,12 @@ static NSString* HBQueuePauseResumeToolbarIdentifier = @"HBQueuePauseRe
[fSavedExpandedItems release];
[fSavedSelectedItems release];
+ [ps release];
+ [detailAttr release];
+ [detailBoldAttr release];
+ [titleAttr release];
+ [shortHeightAttr release];
+
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
@@ -822,40 +830,42 @@ return ![(HBQueueOutlineView*)outlineView isDragging];
}
}
+- (void)initStyles
+{
+ // Attributes
+ ps = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain];
+ [ps setHeadIndent: 40.0];
+ [ps setParagraphSpacing: 1.0];
+ [ps setTabStops:[NSArray array]]; // clear all tabs
+ [ps addTabStop: [[[NSTextTab alloc] initWithType: NSLeftTabStopType location: 20.0] autorelease]];
+
+ detailAttr = [[NSDictionary dictionaryWithObjectsAndKeys:
+ [NSFont systemFontOfSize:10.0], NSFontAttributeName,
+ ps, NSParagraphStyleAttributeName,
+ nil] retain];
+
+ detailBoldAttr = [[NSDictionary dictionaryWithObjectsAndKeys:
+ [NSFont boldSystemFontOfSize:10.0], NSFontAttributeName,
+ ps, NSParagraphStyleAttributeName,
+ nil] retain];
+
+ titleAttr = [[NSDictionary dictionaryWithObjectsAndKeys:
+ [NSFont systemFontOfSize:[NSFont systemFontSize]], NSFontAttributeName,
+ ps, NSParagraphStyleAttributeName,
+ nil] retain];
+
+ shortHeightAttr = [[NSDictionary dictionaryWithObjectsAndKeys:
+ [NSFont systemFontOfSize:2.0], NSFontAttributeName,
+ nil] retain];
+}
+
- (id)outlineView:(NSOutlineView *)fOutlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
{
if ([[tableColumn identifier] isEqualToString:@"desc"])
{
-
-
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
/* Below should be put into a separate method but I am way too f'ing lazy right now */
- NSMutableAttributedString * finalString = [[[NSMutableAttributedString alloc] initWithString: @""] autorelease];
- // Attributes
- NSMutableParagraphStyle * ps = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain];
- [ps setHeadIndent: 40.0];
- [ps setParagraphSpacing: 1.0];
- [ps setTabStops:[NSArray array]]; // clear all tabs
- [ps addTabStop: [[[NSTextTab alloc] initWithType: NSLeftTabStopType location: 20.0] autorelease]];
-
-
- NSDictionary* detailAttr = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSFont systemFontOfSize:10.0], NSFontAttributeName,
- ps, NSParagraphStyleAttributeName,
- nil];
-
- NSDictionary* detailBoldAttr = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSFont boldSystemFontOfSize:10.0], NSFontAttributeName,
- ps, NSParagraphStyleAttributeName,
- nil];
-
- NSDictionary* titleAttr = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSFont systemFontOfSize:[NSFont systemFontSize]], NSFontAttributeName,
- ps, NSParagraphStyleAttributeName,
- nil];
-
- NSDictionary* shortHeightAttr = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSFont systemFontOfSize:2.0], NSFontAttributeName,
- nil];
+ NSMutableAttributedString * finalString = [[NSMutableAttributedString alloc] initWithString: @""];
/* First line, we should strip the destination path and just show the file name and add the title num and chapters (if any) */
NSString * summaryInfo;
@@ -1214,9 +1224,11 @@ return ![(HBQueueOutlineView*)outlineView isDragging];
[finalString appendString:@"\n" withAttributes:detailAttr];
}
i++;
- }
-
- return finalString;
+ }
+
+ [pool release];
+
+ return [finalString autorelease];
}
else if ([[tableColumn identifier] isEqualToString:@"icon"])
{