Skip to content

Commit

Permalink
MMMetalTabStyle instance leaked
Browse files Browse the repository at this point in the history
MMMetalTabStyle created by _commonInit was leaked by initWithCoder:
reassigning the instance variable
  • Loading branch information
Pierre Bernard committed Dec 27, 2014
1 parent f22786e commit e60183a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion MMTabBarView/MMTabBarView/MMTabBarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ - (id)initWithFrame:(NSRect)frame {
if (self) {
// Initialization
[self _commonInit];

_style = [[MMMetalTabStyle alloc] init];

[self registerForDraggedTypes:[NSArray arrayWithObjects:AttachedTabBarButtonUTI, nil]];

// resize
Expand Down Expand Up @@ -2125,6 +2128,10 @@ - (id)initWithCoder:(NSCoder *)aDecoder
_automaticallyAnimates = [aDecoder decodeBoolForKey:@"MMautomaticallyAnimates"];
_alwaysShowActiveTab = [aDecoder decodeBoolForKey:@"MMalwaysShowActiveTab"];
}

if (_style == nil) {
_style = [[MMMetalTabStyle alloc] init];
}
}

return self;
Expand Down Expand Up @@ -2274,7 +2281,7 @@ - (void)_commonInit {
_buttonMaxWidth = 280;
_buttonOptimumWidth = 130;
_tearOffStyle = MMTabBarTearOffAlphaWindow;
_style = [[MMMetalTabStyle alloc] init];
_style = nil;
_isReorderingTabViewItems = NO;
_destinationIndexForDraggedItem = NSNotFound;
_needsUpdate = NO;
Expand Down

0 comments on commit e60183a

Please sign in to comment.