alexrozanski / PXSourceList

Source List control for the Mac
Other
639 stars 77 forks source link

fix a Zeroing Weak References problem #41

Closed Rm1210 closed 10 years ago

Rm1210 commented 10 years ago

When I use PXSourceList In osx 10.7, my program will crash exactly like this problem .

I make a demo for this problem.

Please see if that is this the right way to solved the problem.

alexrozanski commented 10 years ago

Awesome – great catch! I completely forgot that it wasn't possible to reference NSViewController et al. with zeroing weak references prior to 10.8.

One addition I'm going to make is to still use weak references for 10.8+ since these are supported by NSViewController and NSWindowController and are safer.

alexrozanski commented 10 years ago

Actually scratch that – it makes sense to just use unsafe_unretained for cases where PXSourceList is used in apps that target 10.7 or 10.8+, without having to create separate binaries.

Thanks again!

Rm1210 commented 10 years ago

my pleasure!