From e60183ad002eac18ba733740c7ec6276cb9ad58b Mon Sep 17 00:00:00 2001 From: Pierre Bernard Date: Sat, 27 Dec 2014 16:50:41 +0100 Subject: [PATCH] MMMetalTabStyle instance leaked MMMetalTabStyle created by _commonInit was leaked by initWithCoder: reassigning the instance variable --- MMTabBarView/MMTabBarView/MMTabBarView.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.m b/MMTabBarView/MMTabBarView/MMTabBarView.m index 25b3e8e8..dcfb2489 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.m +++ b/MMTabBarView/MMTabBarView/MMTabBarView.m @@ -116,6 +116,9 @@ - (id)initWithFrame:(NSRect)frame { if (self) { // Initialization [self _commonInit]; + + _style = [[MMMetalTabStyle alloc] init]; + [self registerForDraggedTypes:[NSArray arrayWithObjects:AttachedTabBarButtonUTI, nil]]; // resize @@ -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; @@ -2274,7 +2281,7 @@ - (void)_commonInit { _buttonMaxWidth = 280; _buttonOptimumWidth = 130; _tearOffStyle = MMTabBarTearOffAlphaWindow; - _style = [[MMMetalTabStyle alloc] init]; + _style = nil; _isReorderingTabViewItems = NO; _destinationIndexForDraggedItem = NSNotFound; _needsUpdate = NO;