analyzer warning: super init assign to self and check for nil , NSImageView leaking (contentView is a strong reference, therefore release it after assigning)

This commit is contained in:
Stefan Csomor
2017-06-07 14:03:05 +02:00
parent e61922b4c7
commit 0a178ca374

View File

@@ -26,12 +26,13 @@
- (id)init - (id)init
{ {
self = [super init]; if (self = [super init])
if (self) { {
m_dockTile = [NSApplication sharedApplication].dockTile; m_dockTile = [NSApplication sharedApplication].dockTile;
NSImageView* iv = [[NSImageView alloc] init]; NSImageView* iv = [[NSImageView alloc] init];
[iv setImage:[NSApplication sharedApplication].applicationIconImage]; [iv setImage:[NSApplication sharedApplication].applicationIconImage];
[m_dockTile setContentView:iv]; [m_dockTile setContentView:iv];
[iv release];
m_progIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0.0f, 16.0f, m_dockTile.size.width, 24.)]; m_progIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0.0f, 16.0f, m_dockTile.size.width, 24.)];
m_progIndicator.style = NSProgressIndicatorBarStyle; m_progIndicator.style = NSProgressIndicatorBarStyle;