Open JimPitchford opened 8 years ago
Is the issue reproducible with the current macoslib project? If so, what are the steps to reproduce it? Otherwise, please provide a test project. Also, a crash report would be helpful.
Thomas - yes, current version just downloaded. Examples/Cocoa/Text Area. Here's a crash report.
Process: macoslib [1143] Path: /Users/USER/Downloads/*/macoslib.app/Contents/MacOS/macoslib Identifier: com.declaresub.macoslib Version: ??? (1.0.0.0.0) Code Type: X86 (Native) Parent Process: ??? [1] Responsible: macoslib [1143] User ID: 501
Date/Time: 2016-10-20 19:29:06.410 -0500 OS Version: Mac OS X 10.12 (16A323) Report Version: 12 Anonymous UUID: 2190D630-B964-1881-B56B-F8F3D3679DD8
Sleep/Wake UUID: 21ED8318-1827-4347-B187-9C9D9D208004
Time Awake Since Boot: 2300 seconds Time Since Wake: 340 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000002, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Trace/BPT trap: 5 Termination Reason: Namespace SIGNAL, Code 0x5 Terminating Process: exc handler [0]
Application Specific Information: Detected over-release of a CFTypeRef Performing @selector(menuItemAction:) from sender NSMenuItem 0x124a3f0
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.CoreFoundation 0x9463816a _CFRelease + 1722
1 com.apple.Foundation 0x95c5f861 releasingRelinquish + 29
2 com.apple.Foundation 0x95c1f81d -[NSConcreteMapTable assign:key:value:isNew:] + 138
3 com.apple.Foundation 0x95c1f758 -[NSConcreteMapTable setObject:forKey:] + 92
4 com.apple.AppKit 0x92fbeef0 -[NSStackViewContainer _setValueOfCustomSpacing:afterView:] + 233
5 com.apple.AppKit 0x92fbedff -[NSStackViewContainer setCustomSpacing:afterView:] + 89
6 com.apple.AppKit 0x92797c37 -[NSStackView _setCustomSpacing:afterView:animated:] + 192
7 com.apple.AppKit 0x92797b72 -[NSStackView setCustomSpacing:afterView:] + 59
8 com.apple.AppKit 0x92928175 23-[NSInspectorBar _tile]_block_invoke + 227
9 com.apple.CoreFoundation 0x94566871 53-[NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 81
10 com.apple.CoreFoundation 0x9456673f -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 207
11 com.apple.CoreFoundation 0x945665f5 -[NSArray enumerateObjectsUsingBlock:] + 53
12 com.apple.AppKit 0x92925e95 -[NSInspectorBar _tile] + 484
13 com.apple.AppKit 0x92924e3d -[NSInspectorBar _update] + 224
14 com.apple.AppKit 0x92630b28 -[NSTextView updateInspectorBar] + 71
15 com.apple.AppKit 0x926304b4 -[NSTextView updateFontPanel] + 1937
16 com.apple.AppKit 0x92659528 -[NSTextView(NSSharing) becomeFirstResponder] + 308
17 com.apple.AppKit 0x9262d900 -[NSWindow _realMakeFirstResponder:] + 369
18 com.apple.AppKit 0x9262d730 -[NSWindow makeFirstResponder:] + 131
19 com.apple.AppKit 0x928a85f3 -[NSClipView becomeFirstResponder] + 133
20 com.apple.AppKit 0x9262d900 -[NSWindow _realMakeFirstResponder:] + 369
21 com.apple.AppKit 0x9262d730 -[NSWindow makeFirstResponder:] + 131
22 com.apple.AppKit 0x92876da4 -[NSScrollView becomeFirstResponder] + 113
23 com.apple.AppKit 0x9262d900 -[NSWindow _realMakeFirstResponder:] + 369
24 com.apple.AppKit 0x9262d730 -[NSWindow makeFirstResponder:] + 131
25 com.xojo.XojoFramework 0x00cede11 0xc99000 + 347665
26 com.xojo.XojoFramework 0x00cb2d5e 0xc99000 + 105822
27 com.xojo.XojoFramework 0x00e88888 0xc99000 + 2029704
28 com.xojo.XojoFramework 0x00ea0b40 0xc99000 + 2128704
29 com.xojo.XojoFramework 0x00d66bf7 0xc99000 + 842743
30 com.xojo.XojoFramework 0x00cf6db7 0xc99000 + 384439
31 com.apple.Foundation 0x95c53ad8 57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_2 + 32
32 com.apple.CoreFoundation 0x94576934 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 20
33 com.apple.CoreFoundation 0x94576824 _CFXRegistrationPost + 452
34 com.apple.CoreFoundation 0x94576576 _CFXNotificationPost_block_invoke + 54
35 com.apple.CoreFoundation 0x94534843 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1699
36 com.apple.CoreFoundation 0x9453367d _CFXNotificationPost + 637
37 com.apple.Foundation 0x95c0e8e4 -[NSNotificationCenter postNotificationName:object:userInfo:] + 71
38 com.apple.Foundation 0x95c1ac38 -[NSNotificationCenter postNotificationName:object:] + 37
39 com.apple.AppKit 0x9269d23b -[NSWindow becomeKeyWindow] + 1556
40 com.apple.AppKit 0x9269cbec _NXSendWindowNotification + 218
41 com.apple.AppKit 0x9269c566 -[NSWindow _changeKeyAndMainLimitedOK:] + 1111
42 com.apple.AppKit 0x9269c0f5 -[NSWindow makeKeyWindow] + 64
43 com.apple.AppKit 0x9275190e -[NSWindow _makeKeyRegardlessOfVisibility] + 122
44 com.apple.AppKit 0x92d86672 33-[NSWindow makeKeyAndOrderFront:]_block_invoke + 32
45 com.apple.AppKit 0x9269f38e NSPerformVisuallyAtomicChange + 212
46 com.apple.AppKit 0x92751831 -[NSWindow makeKeyAndOrderFront:] + 90
47 com.xojo.XojoFramework 0x00cf68b8 0xc99000 + 383160
48 com.xojo.XojoFramework 0x00d0adff 0xc99000 + 466431
49 com.xojo.XojoFramework 0x00e9f347 0xc99000 + 2122567
50 com.xojo.XojoFramework 0x00e471ee RuntimeShowWindow + 47
51 com.declaresub.macoslib 0x00009d59 Window.Show%%o
Thread 1: 0 libsystem_kernel.dylib 0x9f689cbe __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x9f769dfa _pthread_wqthread + 1210 2 libsystem_pthread.dylib 0x9f76991a start_wqthread + 34
Thread 2: 0 libsystem_kernel.dylib 0x9f689cbe __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x9f769dfa _pthread_wqthread + 1210 2 libsystem_pthread.dylib 0x9f76991a start_wqthread + 34
Thread 3: 0 libsystem_kernel.dylib 0x9f689cbe __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x9f769dfa _pthread_wqthread + 1210 2 libsystem_pthread.dylib 0x9f76991a start_wqthread + 34
Thread 4: 0 libsystem_pthread.dylib 0x9f7698f8 start_wqthread + 0 1 com.declaresub.macoslib 0x00043000 FolderItem.__ctblinit + 8939
Thread 5: 0 libsystem_kernel.dylib 0x9f689cbe __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x9f769c89 _pthread_wqthread + 841 2 libsystem_pthread.dylib 0x9f76991a start_wqthread + 34
Thread 6:: com.apple.NSEventThread 0 libsystem_kernel.dylib 0x9f68191e mach_msg_trap + 10 1 libsystem_kernel.dylib 0x9f680e93 mach_msg + 51 2 com.apple.CoreFoundation 0x94561556 CFRunLoopServiceMachPort + 214 3 com.apple.CoreFoundation 0x94560988 CFRunLoopRun + 1576 4 com.apple.CoreFoundation 0x945600fa CFRunLoopRunSpecific + 506 5 com.apple.CoreFoundation 0x9455feeb CFRunLoopRunInMode + 123 6 com.apple.AppKit 0x926b85b7 _NSEventThread + 235 7 libsystem_pthread.dylib 0x9f76a11b _pthread_body + 184 8 libsystem_pthread.dylib 0x9f76a063 _pthread_start + 243 9 libsystem_pthread.dylib 0x9f76993e thread_start + 34
Thread 0 crashed with X86 Thread State (32-bit): eax: 0x946e819d ebx: 0x012cad80 ecx: 0xa42698a8 edx: 0x94637ac0 edi: 0x02601683 esi: 0x012cad84 ebp: 0xbfffdc88 esp: 0xbfffdc30 ss: 0x00000023 efl: 0x00000206 eip: 0x9463816a cs: 0x0000001b ds: 0x00000023 es: 0x00000023 fs: 0x00000000 gs: 0x0000000f cr2: 0x01403000
Logical CPU: 2 Error Code: 0x00000000 Trap Number: 3
Binary Images:
0x1000 - 0xa4d2ca +com.declaresub.macoslib (??? - 1.0.0.0.0)
External Modification Summary: Calls made by other processes targeting this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by all processes on this machine: task_for_pid: 1740 thread_create: 0 thread_set_state: 0
VM Region Summary: ReadOnly portion of Libraries: Total=279.8M resident=0K(0%) swapped_out_or_unallocated=279.8M(100%) Writable regions: Total=202.8M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=202.8M(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced) =========== ======= ======= ATS (font support) 32.3M 7 Accelerate framework 256K 3 Activity Tracing 256K 2 CG backing stores 8588K 7 CG image 4164K 10 CoreAnimation 44K 8 CoreUI image data 1272K 13 CoreUI image file 156K 3 Foundation 4K 2 Kernel Alloc Once 8K 2 MALLOC 128.7M 55 MALLOC guard page 48K 11 Memory Tag 242 12K 2 OpenGL GLSL 128K 3 Stack 11.0M 8 Stack Guard 56.0M 8 VM_ALLOCATE 208K 32 DATA 19.0M 258 GLSLBUILTINS 2588K 2 IMAGE 528K 2 LINKEDIT 53.0M 15 OBJC 4200K 103 TEXT 226.7M 262 __UNICODE 556K 2 mapped file 98.0M 74 shared memory 16.4M 19 =========== ======= ======= TOTAL 663.7M 887
Model: MacBookPro11,3, BootROM MBP112.0138.B17, 4 processors, Intel Core i7, 2.3 GHz, 16 GB, SMC 2.19f12 Graphics: Intel Iris Pro, Intel Iris Pro, Built-In Graphics: NVIDIA GeForce GT 750M, NVIDIA GeForce GT 750M, PCIe, 2048 MB Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1600 MHz, 0x02FE, - Memory Module: BANK 1/DIMM0, 8 GB, DDR3, 1600 MHz, 0x02FE, - AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x134), Broadcom BCM43xx 1.0 (7.21.171.10.1a16) Bluetooth: Version 5.0.0f18, 3 services, 27 devices, 1 incoming serial ports Network Service: Wi-Fi, AirPort, en0 Serial ATA Device: APPLE SSD SM0512F, 500.28 GB USB Device: USB 3.0 Bus USB Device: Apple Internal Keyboard / Trackpad USB Device: BRCM20702 Hub USB Device: Bluetooth USB Host Controller Thunderbolt Bus: MacBook Pro, Apple Inc., 17.1
Oh dear, it's caused by an object that's missing a Retain call. That'll be difficult to find. I don't have to time to search for this right now, so you'll have to help me.
I have already figured out, with the macoslib project, that something in TextAreaOptionsPanel is causing it, because when I remove the use of this class from the TextAreaWindow's Open event, then there's no crash.
So, please go over each Checkbox control in the TextAreaOptionsPanel and either remove it or comment out the code in their Open handlers. Do this step by step until you find out which ones cause a crash. For example, if I remove ALL checkbox controls, then there's no crash. So, which one cause the crash, that's what I need to know. Then I can look at the responsible declares in macoslib and see if they're missing a Retain call.
The problem is likely in '.usesinspectorbar', which gets set to 'True' at open.
After commenting out the 'open' actions of all the checkboxes, ticking on the last one. ('show inspector bar') seems to work, the first time, upon unticking and re-ticking the checkbox, macoslib crashes unexpectedly.
Right. Even in a simple new project, where I just add a TextArea and put this into its Open event, it crashes:
declare function documentView lib CocoaLib selector "documentView" (obj_id as Integer) as Ptr
declare sub setUsesInspectorBar lib CocoaLib selector "setUsesInspectorBar:" (obj_id as Ptr, value as Boolean)
setUsesInspectorBar (documentView(me.Handle), true)
I have no idea why, though. Could be just a bug in Sierra. Or in Xojo's framework code.
Well, probably not a bug in Sierra, as the same code in an Xcode project does not lead to a crash.
I've posted a question in the forum, maybe someone there has a solution: https://forum.xojo.com/35934
Sadly, it appears to be a bug introduced by Apple in 10.12. Still not fixed in the latest 10.12.1 beta. I've now filed a bug report with Apple: http://www.openradar.me/radar?id=5005564551626752
Thank you for your persistence Thomas. I'll have to disable this function in my next release until Apple resolves it. Presumably impacts 32bit and not 64bit apps. So getting Xojo to 64bit might be faster....?
Found a temporary work around using MBS's NSFontPanelMBS - provides the same functions but in a separate floating window rather than in the toolbar.
I use OSLib's textarea extensions to give me Apple's rulers etc. I now find that these crash in Sierra. To replicate try to use the TextArea example in the current version of MacOSLib. I'm hopeless with Declares and wouldn't know where to start looking for this bug.