JUCE apps crash on macOS 10.8.5

Since a commit from 20 days ago that fixes deprecation warnings, the JUCE Demo as well as our own JUCE-based apps crash upon opening on macOS 10.8.5.

Relevant info:

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

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSWindowGraphicsContext CGContext]: unrecognized selector sent to instance 0x7fc75a4eb380'
terminate called throwing an exception
abort() called

Application Specific Backtrace 1:
0   CoreFoundation                      0x00007fff8c05eb06 __exceptionPreprocess + 198
1   libobjc.A.dylib                     0x00007fff851873f0 objc_exception_throw + 43
2   CoreFoundation                      0x00007fff8c0f540a -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
3   CoreFoundation                      0x00007fff8c04d02e ___forwarding___ + 414
4   CoreFoundation                      0x00007fff8c04ce18 _CF_forwarding_prep_0 + 232
5   DemoRunner                          0x000000010360f235 _ZN4juce19NSViewComponentPeer8drawRectE6CGRect + 117
6   DemoRunner                          0x000000010360cef2 _ZN4juce15JuceNSViewClass8drawRectEP11objc_objectP13objc_selector6CGRect + 130
7   AppKit                              0x00007fff8dc43064 -[NSView _drawRect:clip:] + 4217
8   AppKit                              0x00007fff8dc416c1 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1656
9   AppKit                              0x00007fff8dc41ad9 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2704
10  AppKit                              0x00007fff8dc3f6f2 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 817
11  AppKit                              0x00007fff8dc3f143 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 314
12  AppKit                              0x00007fff8dc3ad6d -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 4675
13  AppKit                              0x00007fff8dc04c93 -[NSView displayIfNeeded] + 1830
14  AppKit                              0x00007fff8dcc1a18 -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 1377
15  AppKit                              0x00007fff8dcc1038 -[NSWindow _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 940
16  AppKit                              0x00007fff8dcc0c1f -[NSWindow orderWindow:relativeTo:] + 159
17  AppKit                              0x00007fff8dcb96dc -[NSWindow makeKeyAndOrderFront:] + 48
18  DemoRunner                          0x0000000103618ba1 _ZN4juce19NSViewComponentPeer7toFrontEb + 209
19  DemoRunner                          0x000000010349804a _ZN4juce9Component7toFrontEb + 218
20  DemoRunner                          0x000000010356a64f _ZN4juce14TopLevelWindow17visibilityChangedEv + 111
21  DemoRunner                          0x000000010356a5cf _ZN4juce15ResizableWindow17visibilityChangedEv + 31
22  DemoRunner                          0x0000000103496a24 _ZN4juce9Component27sendVisibilityChangeMessageEv + 52
23  DemoRunner                          0x00000001034966a8 _ZN4juce9Component10setVisibleEb + 520
24  DemoRunner                          0x0000000102dbcd1e _ZN21DemoRunnerApplication13MainAppWindowC2ERKN4juce6StringE + 526
25  DemoRunner                          0x0000000102dbcafd _ZN21DemoRunnerApplication13MainAppWindowC1ERKN4juce6StringE + 29
26  DemoRunner                          0x0000000102dbc561 _ZN21DemoRunnerApplication10initialiseERKN4juce6StringE + 145
27  DemoRunner                          0x0000000103376ed9 _ZN4juce19JUCEApplicationBase13initialiseAppEv + 201
28  DemoRunner                          0x00000001035724e5 _ZN4juce15JUCEApplication13initialiseAppEv + 21
29  DemoRunner                          0x0000000103376c4d _ZN4juce19JUCEApplicationBase4mainEv + 301
30  DemoRunner                          0x0000000103376abc _ZN4juce19JUCEApplicationBase4mainEiPPKc + 60
31  DemoRunner                          0x0000000102dbc373 main + 51
32  libdyld.dylib                       0x00007fff880ab7e1 start + 0

Thread 0 Crashed:: JUCE Message Thread  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff8654e212 __pthread_kill + 10
1   libsystem_c.dylib             	0x00007fff84e94b24 pthread_kill + 90
2   libsystem_c.dylib             	0x00007fff84ed8f61 abort + 143
3   libc++abi.dylib               	0x00007fff895f79eb abort_message + 257
4   libc++abi.dylib               	0x00007fff895f539a default_terminate() + 28
5   libobjc.A.dylib               	0x00007fff85187873 _objc_terminate() + 91
6   libc++abi.dylib               	0x00007fff895f53c9 safe_handler_caller(void (*)()) + 8
7   libc++abi.dylib               	0x00007fff895f5424 std::terminate() + 16
8   libc++abi.dylib               	0x00007fff895f658b __cxa_throw + 111
9   libobjc.A.dylib               	0x00007fff8518750c objc_exception_throw + 327
10  com.apple.CoreFoundation      	0x00007fff8c0f2f49 -[NSException raise] + 9
11  com.apple.AppKit              	0x00007fff8dc3b6e8 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 7102
12  com.apple.AppKit              	0x00007fff8dc04c93 -[NSView displayIfNeeded] + 1830
13  com.apple.AppKit              	0x00007fff8dcc1a18 -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 1377
14  com.apple.AppKit              	0x00007fff8dcc1038 -[NSWindow _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 940
15  com.apple.AppKit              	0x00007fff8dcc0c1f -[NSWindow orderWindow:relativeTo:] + 159
16  com.apple.AppKit              	0x00007fff8dcb96dc -[NSWindow makeKeyAndOrderFront:] + 48
17  com.juce.demorunner           	0x0000000103618ba1 juce::NSViewComponentPeer::toFront(bool) + 209
18  com.juce.demorunner           	0x000000010349804a juce::Component::toFront(bool) + 218
19  com.juce.demorunner           	0x000000010356a64f juce::TopLevelWindow::visibilityChanged() + 111
20  com.juce.demorunner           	0x000000010356a5cf juce::ResizableWindow::visibilityChanged() + 31
21  com.juce.demorunner           	0x0000000103496a24 juce::Component::sendVisibilityChangeMessage() + 52
22  com.juce.demorunner           	0x00000001034966a8 juce::Component::setVisible(bool) + 520
23  com.juce.demorunner           	0x0000000102dbcd1e DemoRunnerApplication::MainAppWindow::MainAppWindow(juce::String const&) + 526
24  com.juce.demorunner           	0x0000000102dbcafd DemoRunnerApplication::MainAppWindow::MainAppWindow(juce::String const&) + 29
25  com.juce.demorunner           	0x0000000102dbc561 DemoRunnerApplication::initialise(juce::String const&) + 145
26  com.juce.demorunner           	0x0000000103376ed9 juce::JUCEApplicationBase::initialiseApp() + 201
27  com.juce.demorunner           	0x00000001035724e5 juce::JUCEApplication::initialiseApp() + 21
28  com.juce.demorunner           	0x0000000103376c4d juce::JUCEApplicationBase::main() + 301
29  com.juce.demorunner           	0x0000000103376abc juce::JUCEApplicationBase::main(int, char const**) + 60
30  com.juce.demorunner           	0x0000000102dbc373 main + 51
31  libdyld.dylib                 	0x00007fff880ab7e1 start + 1

btw looking to the crash this line seems suspect and indeed it is (reverting that specific change solves the issue)

Note: for a JUCE demo to work on 10.8 before that commit remember to set the deployment target to 10.8 (or lower). I built with Xcode 10.2.1 on macOS 10.14.5

In the future I suggest that whenever the JUCE team fixes deprecation warnings be sure to test the changes on older OSs too because deprecation warnings are a trap more often than not.

Otherwise again it’s going to take most of my day to bisect it :frowning: My process was first assuming that the error is mine and bisecting on own project’s repository and then when I found that it’s coming from JUCE I entered a whole new headache because we use our own bug-fix branch (btw in our branch the problem is now fixed in the juce5 and ARA branches) and git bisect doesn’t work well with merges…

Cheers :sob: Yair

2 Likes

Thanks for reporting, I’m not sure how this one slipped through but we’ll look into it. I’ve pushed a fix here.

2 Likes

Thanks for the quick response