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

Fix problem of assigned controlView being optimised away in XCode 12 … #80

Closed greenius closed 3 years ago

greenius commented 3 years ago

Using Xcode 12, on a release build which uses -Os, MMTabBarView was crashing in some circumstances after creating a tab.

Enabling Zombie detection, I could see it complained about an MMAttachedTabBarButton being released. The problem went away if using -O0 (Add "GCC_OPTIMIZATION_LEVEL = 0" to Release.xcconfig).

The existing code overloaded NSCell controlView with different types. There were compiler warnings about this recommending unsafe retain, so I think the ARC compiler somehow optimised the memory management for these badly.

There was also comments by these properties saying "TODO: fix, rename". So I went ahead and renamed them and updated the controlView accessor methods. There was also some fiddling about with nullable to keep the compiler happy.

Xcode 12 still gives a load of warnings:

Use of '@import' in framework header is discouraged, including this header requires -fmodules

and a linker warning:

ld: warning: dylib (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib) was built for newer macOS version (10.10) than being linked (10.9)

but those are something to fix another day.

brendand commented 3 years ago

Thanks for providing this patch. I got bit by this one just today.