10.12.2 Crashes with NSRulerView

Hi there -


On the 10.12.2 betas I'm seeing loads of crashes in relation to NSRulerView in my apps.

Is this a known issue? The production version of macOS Sierra works just fine.


This is a crash log snippet for the current 16C48b build:


Application Specific Information:

objc_msgSend() selector name: respondsToSelector:



Thread 0 Crashed:: Dispatch queue: com.apple.main-thread

0 libobjc.A.dylib 0x00007fff9c471b5d objc_msgSend + 29

1 com.apple.AppKit 0x00007fff8598a148 -[NSRulerView dealloc] + 55

2 libobjc.A.dylib 0x00007fff9c474e60 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 808

3 com.apple.CoreFoundation 0x00007fff8772b106 _CFAutoreleasePoolPop + 22

4 com.apple.Foundation 0x00007fff89190f13 -[NSAutoreleasePool drain] + 146

5 com.apple.AppKit 0x00007fff85290624 -[NSApplication run] + 1093

6 com.apple.AppKit 0x00007fff8525ae98 NSApplicationMain + 1237

7 com.railmodeller.RailModeller-Pro 0x0000000104a5c34d main + 38

8 libdyld.dylib 0x00007fff9cd61255 start + 1



Any hints appreciated,


Cheers,

Jay

Accepted Reply

I was having a similar problem and thought it was a bug in the beta too but I think it's just a change in behavior that exposes a bug. I could trigger the crash pre beta using methods related to the ruler view that I know should be safe so there was definitely something going on with my code. Check to see if you used setClientView:aView on your ruler view and if so, setClientView:nil before releasing aView. That solved my problem.

Replies

So looking into this further the ruler view is apparently accessing my custom view instance (the content view of the scroller view the ruler belongs to) after the view hierarchy has been teared down.


This is a new bug in the 10.12.2 beta.


Some behaviour in NSRulerView must have changed - why would it try to access the view (it doesn't own/have a strong reference to) after the entire view hierarchy was detached? Pity, it's causing constant crashes in my app as users can toggle views on/off to switch from a 2D to a 2.5D view.


Apple, please fix this before releasing 10.12.2 to the public.


-Jay

I was having a similar problem and thought it was a bug in the beta too but I think it's just a change in behavior that exposes a bug. I could trigger the crash pre beta using methods related to the ruler view that I know should be safe so there was definitely something going on with my code. Check to see if you used setClientView:aView on your ruler view and if so, setClientView:nil before releasing aView. That solved my problem.

Awesome - after stripping down my app to the base minimum this turned out to be the issue as well for me.


Still believe this is a bug that we now manually have to reset the content view.

Anywho, all clear now for a public 10.12.2!


Cheers