MiMo42 / MMTabBarView

A Mac OS X tab bar view that works on 10.9+ with Xcode 9.3+. Pull requests welcomed.

Home Page:http://mimo42.github.com/MMTabBarView/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Retain cycle between MMTabBarView and MMTabBarController

nivekkagicom opened this issue · comments

I am seeing a retain cycle between MMTabBarView and MMTabBarController. It is my understanding that instance variables are strong by default under ARC so _tabBarView is a strong reference back to the MMTabBarView that allocated it and holds a strong pointer to its controller in _controller.

@implementation MMTabBarController
{
    MMTabBarView    *_tabBarView;
    NSMenu          *_overflowMenu;
}
@implementation MMTabBarView
{
    // control basics
    NSTabView                       *_tabView;                    // the tab view being navigated
    MMOverflowPopUpButton           *_overflowPopUpButton;        // for too many tabs
    MMRolloverButton                *_addTabButton;
    MMTabBarController              *_controller;

Should not __weak be used to make the reference back to the view weak? That is

@implementation MMTabBarController
{
    __weak MMTabBarView *_tabBarView;
    NSMenu          *_overflowMenu;
}

Thanks for nailing it. See Bugfix Release 1.2.1