Out-of-the box 32 bit GUI app crashes in OSX <= 10.14

As the title says: generate a new GUI project with Projucer and set the target architecture to 32 bit. Build and run it on OSX 10.14. Here is the crash report:

Process: GUICrashtest [421]
Path: /Volumes/*/GUICrashtest.app/Contents/MacOS/GUICrashtest
Identifier: com.yourcompany.GUICrashtest
Version: 1.0.0 (1.0.0)
Code Type: X86 (Native)
Parent Process: ??? [1]
Responsible: GUICrashtest [421]
User ID: 501

Date/Time: 2020-10-27 18:26:05.211 +0100
OS Version: Mac OS X 10.14.6 (18G6032)
Report Version: 12
Anonymous UUID: 37DC9A17-BAA0-8898-9DBB-F3BFF855E269

Time Awake Since Boot: 44 seconds

System Integrity Protection: enabled

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

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000020
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [421]

VM Regions Near 0x20:
–>
__TEXT 00000000000e3000-000000000062e000 [ 5420K] r-x/rwx SM=COW /Volumes/*/GUICrashtest.app/Contents/MacOS/GUICrashtest

Application Specific Information:
objc_msgSend() selector name: jzp©®†ø’¶

Thread 0 Crashed:: JUCE Message Thread Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0xa6d5bfac objc_msgSendSuper + 12
1 com.yourcompany.GUICrashtest 0x00520749 _NSRect juce::ObjCClass::sendSuperclassMessage<_NSRect, _NSRect, NSScreen*>(objc_object*, objc_selector*, _NSRect, NSScreen*) + 153 (juce_osx_ObjCHelpers.h:299)
2 com.yourcompany.GUICrashtest 0x0051f50e juce::JuceNSWindowClass::constrainFrameRect(objc_object*, objc_selector*, _NSRect, NSScreen*) + 174 (juce_mac_NSViewComponentPeer.mm:2059)
3 com.apple.AppKit 0x915f3872 -[NSWindow _overrideDefeatingConstrainFrameRect:toScreen:] + 649
4 com.apple.AppKit 0x915f2810 -[NSWindow _reallyDoOrderWindowAboveOrBelow:relativeTo:findKey:forCounter:force:isModal:] + 989
5 com.apple.AppKit 0x915f23ad -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 134
6 com.apple.AppKit 0x915f231f -[NSWindow _doOrderWindowWithoutAnimation:relativeTo:findKey:forCounter:force:isModal:] + 51
7 com.apple.AppKit 0x915f0f00 -[NSWindow _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 259
8 com.apple.AppKit 0x915f0daf -[NSWindow orderWindow:relativeTo:] + 142
9 com.apple.AppKit 0x915ef894 -[NSWindow makeKeyAndOrderFront:] + 68
10 com.yourcompany.GUICrashtest 0x00525364 juce::NSViewComponentPeer::toFront(bool) + 244 (juce_mac_NSViewComponentPeer.mm:522)
11 com.yourcompany.GUICrashtest 0x0035f080 juce::Component::toFront(bool) + 240 (juce_Component.cpp:900)
12 com.yourcompany.GUICrashtest 0x00467d15 juce::TopLevelWindow::visibilityChanged() + 117 (juce_TopLevelWindow.cpp:189)
13 com.yourcompany.GUICrashtest 0x00467c8c juce::ResizableWindow::visibilityChanged() + 28 (juce_ResizableWindow.cpp:198)
14 com.yourcompany.GUICrashtest 0x0035d4b0 juce::Component::sendVisibilityChangeMessage() + 48 (juce_Component.cpp:579)
15 com.yourcompany.GUICrashtest 0x0035d028 juce::Component::setVisible(bool) + 568 (juce_Component.cpp:560)
16 com.yourcompany.GUICrashtest 0x000e48ca GUICrashtestApplication::MainWindow::MainWindow(juce::String) + 346 (Main.cpp:77)
17 com.yourcompany.GUICrashtest 0x000e475e GUICrashtestApplication::MainWindow::MainWindow(juce::String) + 30 (Main.cpp:78)
18 com.yourcompany.GUICrashtest 0x000e43ca GUICrashtestApplication::initialise(juce::String const&) + 106 (Main.cpp:28)
19 com.yourcompany.GUICrashtest 0x00215442 juce::JUCEApplicationBase::initialiseApp() + 226 (juce_ApplicationBase.cpp:297)
20 com.yourcompany.GUICrashtest 0x00471d87 juce::JUCEApplication::initialiseApp() + 23 (juce_Application.cpp:92)
21 com.yourcompany.GUICrashtest 0x002150b0 juce::JUCEApplicationBase::main() + 752 (juce_ApplicationBase.cpp:256)
22 com.yourcompany.GUICrashtest 0x00214d58 juce::JUCEApplicationBase::main(int, char const**) + 72 (juce_ApplicationBase.cpp:242)
23 com.yourcompany.GUICrashtest 0x000e41c0 main + 64 (Main.cpp:105)
24 libdyld.dylib 0xa7bfe051 start + 1

Thread 1:: Dispatch queue: com.apple.CoreText.InitShapingGlyphs
0 com.apple.CoreText 0x94f4bef0 ConvertOTFeatureToAATFeature(unsigned long, PseudoFeature&) + 0
1 com.apple.CoreText 0x94e8dc77 (anonymous namespace)::MorxTableBuilder::From(TFont const&, OTL::GCommon::Header const*, void const*, (anonymous namespace)::OTFeaturesMap&) + 1165
2 com.apple.CoreText 0x94e8b83b ConvertGSUBToMorxInternal(TFont const&, __CFData const*) + 1235
3 com.apple.CoreText 0x94e8ae47 ConvertToMorx(TFont const&) + 85
4 com.apple.CoreText 0x94e8ac36 TAATMorphTable::AddShapingGlyphs(TFont const&, MorxConversionFlag, std::__1::function<void (unsigned short, unsigned short)>, std::__1::function<void ()>) + 838
5 com.apple.CoreText 0x94e8a224 TFont::InitShapingGlyphs(MorxConversionFlag) const + 324
6 com.apple.CoreText 0x94e89ecc InitShapingGlyphsOnQueue(__CTFont const*, NSObject<OS_dispatch_queue>)::$_11::__invoke(void) + 30
7 libdispatch.dylib 0xa7bb26f7 _dispatch_client_callout + 58
8 libdispatch.dylib 0xa7bba134 _dispatch_lane_serial_drain + 576
9 libdispatch.dylib 0xa7bbac30 _dispatch_lane_invoke + 346
10 libdispatch.dylib 0xa7bc30f5 _dispatch_workloop_worker_thread + 573
11 libsystem_pthread.dylib 0xa7dee9a9 _pthread_wqthread + 391
12 libsystem_pthread.dylib 0xa7dee7aa start_wqthread + 34

Thread 2:
0 libsystem_pthread.dylib 0xa7dee788 start_wqthread + 0

Thread 3:: Dispatch queue: com.apple.root.background-qos
0 com.apple.AppKit 0x91f9902c ___NSPersistentUIDispatchQueueAsync_block_invoke.llvm.17885329133913216630 + 0
1 libdispatch.dylib 0xa7bb26b4 _dispatch_call_block_and_release + 15
2 libdispatch.dylib 0xa7bc1e8c _dispatch_root_queue_drain + 633
3 libdispatch.dylib 0xa7bc251c _dispatch_worker_thread2 + 98
4 libsystem_pthread.dylib 0xa7deea36 _pthread_wqthread + 532
5 libsystem_pthread.dylib 0xa7dee7aa start_wqthread + 34

Thread 4:
0 libsystem_pthread.dylib 0xa7dee788 start_wqthread + 0

Thread 0 crashed with X86 Thread State (32-bit):
eax: 0xbff1d418 ebx: 0xbff1d418 ecx: 0xbff1d310 edx: 0x00000000
edi: 0x00000000 esi: 0xbff1d33c ebp: 0xbff1d328 esp: 0xbff1d2a8
ss: 0x00000023 efl: 0x00010246 eip: 0xa6d5bfac cs: 0x0000001b
ds: 0x00000023 es: 0x00000023 fs: 0x00000000 gs: 0x0000000f
cr2: 0x00000020

Logical CPU: 1
Error Code: 0x00000004
Trap Number: 14

It got introduced with this commit: https://github.com/juce-framework/JUCE/commit/a5d26db341789413aebf57bab3aab1ddfbe68153 . Commenting out that one new call makes 32 bit apps work again. That’s all I can say for now…

It looks like we need to call the objc_msgSendSuper_stret() method there on 32-bit systems instead of objc_msgSendSuper() as the NSRect return type is counted as a “data structure” type instead of a “simple” type so isn’t returned via the registers.

Can you apply the following patch to juce_osx_ObjCHelpers.h and see if it fixes things?

0001-macOS-Use-objc_msgSendSuper_stret-for-return-types-8.patch (1.1 KB)

1 Like

That’s a fine patch indeed… thank you very much!

Great, we’ll get that on the develop branch then. Thanks for testing.

1 Like