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

Fixed issue where if you turned on auto hiding, then you closed the 2nd to last tab, the tab bar would hide, BUT it wouldn't release the NSTabViewItem you just closed. #44

Open chrismcs opened 8 years ago

chrismcs commented 8 years ago

If you have auto-hiding turned on for your tab bar and then you close the 2nd to the last tab, the update: method would hide the tab bar, then short-circuit and return. This means it never actually removed the tab bar item (if you are watching allocations in Instruments, you’d see that there are still 2 NSTabViewItems that are alive). Also, because update: was short-circuited, the delegate never got “didDetachTabViewItem” called for that tab you just closed.

This may or may not be the best way to fix it - I’m not familiar enough with the project to know if there’s a more appropriate place to put this fix - but from my testing, it resolves the memory issue + the delegate call issue.

TAKeanice commented 5 years ago

We encountered the same issue in Vienna (https://github.com/ViennaRSS/vienna-rss), so I made a one-line fix in a49ddf63454511f1f02e8159bb5169a6f832ccfb for it. It is much simpler, but does the trick. It could be cherry-picked as an alternative to this PR. Of course, for consistency reasons, the demo app should log the delegate call just as all the others, which is implemented in @chrismcs commit (55ef0a6e473d2d9e730b3d30c061cfaa851558e1) and thus included in the PR