MiMo42 / MMTabBarView

A Mac OS X tab bar view that works on 10.9+ with Xcode 9.3+. Pull requests welcomed.
http://mimo42.github.com/MMTabBarView/
243 stars 79 forks source link

Retain cycle between MMTabBarView and MMTabBarController #36

Closed nivekkagicom closed 8 years ago

nivekkagicom commented 8 years ago

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;
}
MiMo42 commented 8 years ago

Thanks for nailing it. See Bugfix Release 1.2.1