Disabling Smart Quotes in `DesktopTextArea`

There have been several threads in the past about disabling the annoying smart quotes insertion in the TextArea control on macOS over years. I had always had success with this method:

#if TargetCocoa then
  Declare Function NSClassFromString Lib "Cocoa" (aClassName As CFStringRef) As Ptr
  
  dim myTextArea as ptr
  declare function documentView lib "Cocoa" selector "documentView" _
  (obj_id as Integer) as Ptr
  
  myTextArea = documentView(t.Handle)
  
  Declare Sub setAutomaticQuoteSubstitutionEnabled Lib "Cocoa" Selector "setAutomaticQuoteSubstitutionEnabled:" _
  (Id as ptr, value as Boolean)
  
  setAutomaticQuoteSubstitutionEnabled (myTextArea, value)
#endif

However, in a new project, this causes an immediate hard crash if I use it on the new DesktopTextArea class (instead of the old TextArea class. I’ve updated the signature to take a reference to a DesktopTextArea instance and have substituted t.Handle with t.Handle.Integer because an integer is required and not a pointer.

This is the crash log I’m getting:

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               TOMLKit Dev Harness.debug [91294]
Path:                  /var/folders/*/TOMLKit Dev Harness.debug.app/Contents/MacOS/TOMLKit Dev Harness.debug
Identifier:            TOMLKit Dev Harness.debug
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2022-01-28 11:16:20.3764 +0000
OS Version:            macOS 12.1 (21C52)
Report Version:        12
Anonymous UUID:        5EF14135-3784-3137-658B-E18B0A661DBF

Sleep/Wake UUID:       AA18D2F9-55A2-431B-8A5C-50B5FE939522

Time Awake Since Boot: 1100000 seconds
Time Since Wake:       321 seconds

System Integrity Protection: enabled

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

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000021d04d2c810
Exception Codes:       0x0000000000000001, 0x0000021d04d2c810
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [91294]

VM Region Info: 0x21d04d2c810 is not in any region.  Bytes after previous region: 1842621892625  Bytes before following region: 103229458036720
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      commpage (reserved)        1000000000-7000000000   [384.0G] ---/--- SM=NUL  ...(unallocated)
--->  GAP OF 0x5f9000000000 BYTES
      MALLOC_NANO              600000000000-600008000000 [128.0M] rw-/rwx SM=PRV  

Application Specific Information:
objc_msgSend() selector name: documentView


Kernel Triage:
VM - pmap_enter failed with resource shortage


Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib               	       0x1c3e68320 objc_msgSend + 32
1   TOMLKit Dev Harness.debug     	       0x1042c6b8c Window1.Window1.SetAutomaticQuoteSubstitutionEnabled%%o<Window1.Window1>o<DesktopTextArea>b + 420 (/Window1:81)
2   TOMLKit Dev Harness.debug     	       0x1042c67a0 Window1.Window1.Event_Opening%%o<Window1.Window1> + 236 (/Window1:65)
3   XojoFramework                 	       0x1051f97e4 FireWindowOpenEvents + 352
4   TOMLKit Dev Harness.debug     	       0x1042712c0 DesktopWindow.Constructor%%o<DesktopWindow> + 68
5   TOMLKit Dev Harness.debug     	       0x1042c6e9c Window1.Window1%o<Window1.Window1>% + 500 (/Window1:94)
6   TOMLKit Dev Harness.debug     	       0x1042cc918 _MakeDefaultView + 112 (/#main:63)
7   TOMLKit Dev Harness.debug     	       0x1042ccbd8 _LateStartup + 84 (/#main:99)
8   XojoFramework                 	       0x1050624fc CocoaFinishApplicationStartup() + 236
9   XojoFramework                 	       0x105060fe8 0x104fd4000 + 577512
10  CoreFoundation                	       0x1c409d200 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 28
11  CoreFoundation                	       0x1c4140b84 ___CFXRegistrationPost_block_invoke + 52
12  CoreFoundation                	       0x1c4140af0 _CFXRegistrationPost + 456
13  CoreFoundation                	       0x1c406beb0 _CFXNotificationPost + 720
14  Foundation                    	       0x1c4f21e3c -[NSNotificationCenter postNotificationName:object:userInfo:] + 96
15  AppKit                        	       0x1c6c059f0 -[NSApplication _postDidFinishNotification] + 340
16  AppKit                        	       0x1c6c05708 -[NSApplication _sendFinishLaunchingNotification] + 236
17  AppKit                        	       0x1c6bfd17c _DPSNextEvent + 2024
18  AppKit                        	       0x1c6bfb584 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1332
19  XojoFramework                 	       0x105062de4 0x104fd4000 + 585188
20  XojoFramework                 	       0x105062e6c 0x104fd4000 + 585324
21  TOMLKit Dev Harness.debug     	       0x104250ca4 DesktopApplication._CallFunctionWithExceptionHandling%%o<DesktopApplication>p + 164
22  XojoFramework                 	       0x1051e3f54 CallFunctionWithExceptionHandling(void (*)()) + 180
23  XojoFramework                 	       0x105062e08 0x104fd4000 + 585224
24  AppKit                        	       0x1c6bed5a4 -[NSApplication run] + 596
25  XojoFramework                 	       0x1051e27bc RuntimeRun + 48
26  TOMLKit Dev Harness.debug     	       0x10427ba30 REALbasic._RuntimeRun + 28
27  TOMLKit Dev Harness.debug     	       0x1042ccf10 _Main + 712 (/#main:107)
28  TOMLKit Dev Harness.debug     	       0x1042cc340 main + 36
29  dyld                          	       0x1045390f4 start + 520

Thread 1:
0   libsystem_pthread.dylib       	       0x1c3fd8010 start_wqthread + 0

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

Thread 3:
0   libsystem_pthread.dylib       	       0x1c3fd8010 start_wqthread + 0


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x010000010532f15f   x1: 0x000000020e584e0a   x2: 0x1715609ff3d9d5b5   x3: 0xfffffffffffffff5
    x4: 0x0000000000000000   x5: 0x0000000000000000   x6: 0x656d616e7373616c   x7: 0x00000000000001e0
    x8: 0x000000012e086600   x9: 0x000000016bc81fc8  x10: 0x6ae100010532f15f  x11: 0x000000016bc81fd8
   x12: 0x000000016bc82008  x13: 0x0000021d04d2c800  x14: 0x0000000100000000  x15: 0x0000021d04d2c800
   x16: 0x0000021d04d2c800  x17: 0x0000000105076224  x18: 0x000000010e6f73fc  x19: 0x000000012c634988
   x20: 0x00006000010c8c60  x21: 0x00000001053398f0  x22: 0x00000001053398b8  x23: 0x00000001052a79bc
   x24: 0x00000001052a79c4  x25: 0x000000012c635f70  x26: 0x0000000000000001  x27: 0x000000010533a000
   x28: 0x000000010533a000   fp: 0x000000016bc82050   lr: 0x00000001042c6b8c
    sp: 0x000000016bc81ef0   pc: 0x00000001c3e68320 cpsr: 0x20001000
   far: 0x0000021d04d2c810  esr: 0x92000005 (Data Abort) byte read Translation fault

Binary Images:
       0x1c3e62000 -        0x1c3e9dfff libobjc.A.dylib (*) <8a930227-747e-381f-bb29-2dfe267a84f7> /usr/lib/libobjc.A.dylib
       0x10417c000 -        0x1042e7fff TOMLKit Dev Harness.debug (*) <9f31fb77-632d-3cf1-83a7-69b4e177af89> /private/var/folders/*/TOMLKit Dev Harness.debug.app/Contents/MacOS/TOMLKit Dev Harness.debug
       0x104fd4000 -        0x1052f7fff XojoFramework (*) <4a5f8de8-eefe-37a6-ba0d-bf7cb4ecd1fb> /private/var/folders/*/TOMLKit Dev Harness.debug.app/Contents/Frameworks/XojoFramework.framework/Versions/A/XojoFramework
       0x1c4024000 -        0x1c4567fff com.apple.CoreFoundation (6.9) <f5ea9592-4ef9-3d35-b23d-5c21283acc52> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       0x1c4f18000 -        0x1c5305fff com.apple.Foundation (6.9) <cd7cdf11-986e-3754-8011-e628c3be8380> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
       0x1c6bbb000 -        0x1c7a6efff com.apple.AppKit (6.9) <a8bbc643-113d-310f-96b6-77a973bf2dba> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       0x104534000 -        0x104593fff dyld (*) <7e92b284-4b90-3b68-b31a-3ddc4c0e8d40> /usr/lib/dyld
       0x1c3fd6000 -        0x1c3fe2fff libsystem_pthread.dylib (*) <ed328b18-eeef-3b15-8858-798b19b0c2cd> /usr/lib/system/libsystem_pthread.dylib
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???

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: 0
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=1.0G resident=0K(0%) swapped_out_or_unallocated=1.0G(100%)
Writable regions: Total=978.3M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=978.3M(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Accelerate framework               128K        1 
Activity Tracing                   256K        1 
CG backing stores                 4032K        4 
ColorSync                          512K       24 
CoreGraphics                        16K        1 
CoreUI image data                  160K        1 
Foundation                          16K        1 
Kernel Alloc Once                   32K        1 
MALLOC                           219.3M       37 
MALLOC guard page                  192K        9 
MALLOC_MEDIUM (reserved)         360.0M        3         reserved VM address space (unallocated)
MALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)
STACK GUARD                       56.1M        4 
Stack                             9808K        4 
VM_ALLOCATE                        1.0G       13 
__AUTH                            2439K      274 
__AUTH_CONST                      18.3M      451 
__DATA                            15.3M      439 
__DATA_CONST                      16.8M      457 
__DATA_DIRTY                      1676K      193 
__FONT_DATA                          4K        1 
__LINKEDIT                       577.5M        5 
__OBJC_CONST                      3231K      243 
__OBJC_RO                         82.0M        1 
__OBJC_RW                         3104K        1 
__TEXT                           445.4M      475 
__UNICODE                          588K        1 
__XOJO                              16K        1 
dyld private memory               1024K        1 
mapped file                      150.0M       18 
shared memory                      864K       14 
===========                     =======  ======= 
TOTAL                              3.3G     2680 
TOTAL, minus reserved VM space     2.6G     2680 



-----------
Full Report
-----------

{"app_name":"TOMLKit Dev Harness.debug","timestamp":"2022-01-28 11:16:22.00 +0000","app_version":"","slice_uuid":"9f31fb77-632d-3cf1-83a7-69b4e177af89","build_version":"","platform":1,"share_with_app_devs":1,"is_first_party":1,"bug_type":"309","os_version":"macOS 12.1 (21C52)","incident_id":"B175ED96-F02F-4401-B412-C1E586017A7C","name":"TOMLKit Dev Harness.debug"}
{
  "uptime" : 1100000,
  "procLaunch" : "2022-01-28 11:16:19.8283 +0000",
  "procRole" : "Foreground",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 210,
  "modelCode" : "MacBookPro18,1",
  "procStartAbsTime" : 26589508610073,
  "coalitionID" : 91902,
  "osVersion" : {
    "train" : "macOS 12.1",
    "build" : "21C52",
    "releaseType" : "User"
  },
  "captureTime" : "2022-01-28 11:16:20.3764 +0000",
  "incident" : "B175ED96-F02F-4401-B412-C1E586017A7C",
  "bug_type" : "309",
  "pid" : 91294,
  "procExitAbsTime" : 26589521545451,
  "translated" : false,
  "cpuType" : "ARM-64",
  "procName" : "TOMLKit Dev Harness.debug",
  "procPath" : "\/var\/folders\/*\/TOMLKit Dev Harness.debug.app\/Contents\/MacOS\/TOMLKit Dev Harness.debug",
  "parentProc" : "launchd",
  "parentPid" : 1,
  "coalitionName" : "com.garrypettet.tomlkit-dev-harness",
  "crashReporterKey" : "5EF14135-3784-3137-658B-E18B0A661DBF",
  "wakeTime" : 321,
  "sleepWakeUUID" : "AA18D2F9-55A2-431B-8A5C-50B5FE939522",
  "sip" : "enabled",
  "vmRegionInfo" : "0x21d04d2c810 is not in any region.  Bytes after previous region: 1842621892625  Bytes before following region: 103229458036720\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      commpage (reserved)        1000000000-7000000000   [384.0G] ---\/--- SM=NUL  ...(unallocated)\n--->  GAP OF 0x5f9000000000 BYTES\n      MALLOC_NANO              600000000000-600008000000 [128.0M] rw-\/rwx SM=PRV  ",
  "isCorpse" : 1,
  "exception" : {"codes":"0x0000000000000001, 0x0000021d04d2c810","rawCodes":[1,2323658229776],"type":"EXC_BAD_ACCESS","signal":"SIGSEGV","subtype":"KERN_INVALID_ADDRESS at 0x0000021d04d2c810"},
  "termination" : {"flags":0,"code":11,"namespace":"SIGNAL","indicator":"Segmentation fault: 11","byProc":"exc handler","byPid":91294},
  "ktriageinfo" : "VM - pmap_enter failed with resource shortage\n",
  "vmregioninfo" : "0x21d04d2c810 is not in any region.  Bytes after previous region: 1842621892625  Bytes before following region: 103229458036720\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      commpage (reserved)        1000000000-7000000000   [384.0G] ---\/--- SM=NUL  ...(unallocated)\n--->  GAP OF 0x5f9000000000 BYTES\n      MALLOC_NANO              600000000000-600008000000 [128.0M] rw-\/rwx SM=PRV  ",
  "asi" : {"objc":["objc_msgSend() selector name: documentView"]},
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 0,
  "threads" : [{"triggered":true,"id":6375521,"threadState":{"x":[{"value":72057598420119903,"symbolLocation":72057594037927943,"symbol":"OBJC_CLASS_$_XOJScrollView"},{"value":8830602762,"objc-selector":"documentView"},{"value":1663341877490472373},{"value":18446744073709551605},{"value":0},{"value":0},{"value":7308604897303421292},{"value":480},{"value":5067269632},{"value":6103244744},{"value":7701436842162450783},{"value":6103244760},{"value":6103244808},{"value":2323658229760},{"value":4294967296},{"value":2323658229760},{"value":2323658229760},{"value":4379337252},{"value":4537152508},{"value":5039671688},{"value":105553133866080},{"value":4382234864,"symbolLocation":0,"symbol":"DesktopControlClassDecl"},{"value":4382234808,"symbolLocation":0,"symbol":"ControlClassDecl"},{"value":4381637052},{"value":4381637060},{"value":5039677296},{"value":1},{"value":4382236672,"symbolLocation":32,"symbol":"RadioButtonClassDecl"},{"value":4382236672,"symbolLocation":32,"symbol":"RadioButtonClassDecl"}],"flavor":"ARM_THREAD_STATE64","lr":{"value":4364987276},"cpsr":{"value":536875008},"fp":{"value":6103244880},"sp":{"value":6103244528},"esr":{"value":2449473541,"description":"(Data Abort) byte read Translation fault"},"pc":{"value":7581631264,"matchesCrashFrame":1},"far":{"value":2323658229776}},"queue":"com.apple.main-thread","frames":[{"imageOffset":25376,"symbol":"objc_msgSend","symbolLocation":32,"imageIndex":0},{"imageOffset":1354636,"sourceLine":81,"sourceFile":"\/Window1","symbol":"Window1.Window1.SetAutomaticQuoteSubstitutionEnabled%%o<Window1.Window1>o<DesktopTextArea>b","imageIndex":1,"symbolLocation":420},{"imageOffset":1353632,"sourceLine":65,"sourceFile":"\/Window1","symbol":"Window1.Window1.Event_Opening%%o<Window1.Window1>","imageIndex":1,"symbolLocation":236},{"imageOffset":2250724,"symbol":"FireWindowOpenEvents","symbolLocation":352,"imageIndex":2},{"imageOffset":1004224,"symbol":"DesktopWindow.Constructor%%o<DesktopWindow>","symbolLocation":68,"imageIndex":1},{"imageOffset":1355420,"sourceLine":94,"sourceFile":"\/Window1","symbol":"Window1.Window1%o<Window1.Window1>%","imageIndex":1,"symbolLocation":500},{"imageOffset":1378584,"sourceLine":63,"sourceFile":"\/#main","symbol":"_MakeDefaultView","imageIndex":1,"symbolLocation":112},{"imageOffset":1379288,"sourceLine":99,"sourceFile":"\/#main","symbol":"_LateStartup","imageIndex":1,"symbolLocation":84},{"imageOffset":582908,"symbol":"CocoaFinishApplicationStartup()","symbolLocation":236,"imageIndex":2},{"imageOffset":577512,"imageIndex":2},{"imageOffset":496128,"symbol":"__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__","symbolLocation":28,"imageIndex":3},{"imageOffset":1166212,"symbol":"___CFXRegistrationPost_block_invoke","symbolLocation":52,"imageIndex":3},{"imageOffset":1166064,"symbol":"_CFXRegistrationPost","symbolLocation":456,"imageIndex":3},{"imageOffset":294576,"symbol":"_CFXNotificationPost","symbolLocation":720,"imageIndex":3},{"imageOffset":40508,"symbol":"-[NSNotificationCenter postNotificationName:object:userInfo:]","symbolLocation":96,"imageIndex":4},{"imageOffset":305648,"symbol":"-[NSApplication _postDidFinishNotification]","symbolLocation":340,"imageIndex":5},{"imageOffset":304904,"symbol":"-[NSApplication _sendFinishLaunchingNotification]","symbolLocation":236,"imageIndex":5},{"imageOffset":270716,"symbol":"_DPSNextEvent","symbolLocation":2024,"imageIndex":5},{"imageOffset":263556,"symbol":"-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]","symbolLocation":1332,"imageIndex":5},{"imageOffset":585188,"imageIndex":2},{"imageOffset":585324,"imageIndex":2},{"imageOffset":871588,"symbol":"DesktopApplication._CallFunctionWithExceptionHandling%%o<DesktopApplication>p","symbolLocation":164,"imageIndex":1},{"imageOffset":2162516,"symbol":"CallFunctionWithExceptionHandling(void (*)())","symbolLocation":180,"imageIndex":2},{"imageOffset":585224,"imageIndex":2},{"imageOffset":206244,"symbol":"-[NSApplication run]","symbolLocation":596,"imageIndex":5},{"imageOffset":2156476,"symbol":"RuntimeRun","symbolLocation":48,"imageIndex":2},{"imageOffset":1047088,"symbol":"REALbasic._RuntimeRun","symbolLocation":28,"imageIndex":1},{"imageOffset":1380112,"sourceLine":107,"sourceFile":"\/#main","symbol":"_Main","imageIndex":1,"symbolLocation":712},{"imageOffset":1377088,"symbol":"main","symbolLocation":36,"imageIndex":1},{"imageOffset":20724,"symbol":"start","symbolLocation":520,"imageIndex":6}]},{"id":6375596,"frames":[{"imageOffset":8208,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":7}]},{"id":6375597,"frames":[{"imageOffset":8208,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":7}]},{"id":6375602,"frames":[{"imageOffset":8208,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":7}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7581605888,
    "size" : 245760,
    "uuid" : "8a930227-747e-381f-bb29-2dfe267a84f7",
    "path" : "\/usr\/lib\/libobjc.A.dylib",
    "name" : "libobjc.A.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4363632640,
    "size" : 1490944,
    "uuid" : "9f31fb77-632d-3cf1-83a7-69b4e177af89",
    "path" : "\/private\/var\/folders\/*\/TOMLKit Dev Harness.debug.app\/Contents\/MacOS\/TOMLKit Dev Harness.debug",
    "name" : "TOMLKit Dev Harness.debug"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4378673152,
    "size" : 3293184,
    "uuid" : "4a5f8de8-eefe-37a6-ba0d-bf7cb4ecd1fb",
    "path" : "\/private\/var\/folders\/*\/TOMLKit Dev Harness.debug.app\/Contents\/Frameworks\/XojoFramework.framework\/Versions\/A\/XojoFramework",
    "name" : "XojoFramework"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7583449088,
    "CFBundleShortVersionString" : "6.9",
    "CFBundleIdentifier" : "com.apple.CoreFoundation",
    "size" : 5521408,
    "uuid" : "f5ea9592-4ef9-3d35-b23d-5c21283acc52",
    "path" : "\/System\/Library\/Frameworks\/CoreFoundation.framework\/Versions\/A\/CoreFoundation",
    "name" : "CoreFoundation",
    "CFBundleVersion" : "1856.105"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7599128576,
    "CFBundleShortVersionString" : "6.9",
    "CFBundleIdentifier" : "com.apple.Foundation",
    "size" : 4120576,
    "uuid" : "cd7cdf11-986e-3754-8011-e628c3be8380",
    "path" : "\/System\/Library\/Frameworks\/Foundation.framework\/Versions\/C\/Foundation",
    "name" : "Foundation",
    "CFBundleVersion" : "1856.105"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7629156352,
    "CFBundleShortVersionString" : "6.9",
    "CFBundleIdentifier" : "com.apple.AppKit",
    "size" : 15417344,
    "uuid" : "a8bbc643-113d-310f-96b6-77a973bf2dba",
    "path" : "\/System\/Library\/Frameworks\/AppKit.framework\/Versions\/C\/AppKit",
    "name" : "AppKit",
    "CFBundleVersion" : "2113.20.111"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 4367532032,
    "size" : 393216,
    "uuid" : "7e92b284-4b90-3b68-b31a-3ddc4c0e8d40",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7583129600,
    "size" : 53248,
    "uuid" : "ed328b18-eeef-3b15-8858-798b19b0c2cd",
    "path" : "\/usr\/lib\/system\/libsystem_pthread.dylib",
    "name" : "libsystem_pthread.dylib"
  },
  {
    "size" : 0,
    "source" : "A",
    "base" : 0,
    "uuid" : "00000000-0000-0000-0000-000000000000"
  }
],
  "sharedCache" : {
  "base" : 7579959296,
  "size" : 3089596416,
  "uuid" : "66c33c62-48a9-31e5-b8b5-7a71c9760d07"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=1.0G resident=0K(0%) swapped_out_or_unallocated=1.0G(100%)\nWritable regions: Total=978.3M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=978.3M(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nAccelerate framework               128K        1 \nActivity Tracing                   256K        1 \nCG backing stores                 4032K        4 \nColorSync                          512K       24 \nCoreGraphics                        16K        1 \nCoreUI image data                  160K        1 \nFoundation                          16K        1 \nKernel Alloc Once                   32K        1 \nMALLOC                           219.3M       37 \nMALLOC guard page                  192K        9 \nMALLOC_MEDIUM (reserved)         360.0M        3         reserved VM address space (unallocated)\nMALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)\nSTACK GUARD                       56.1M        4 \nStack                             9808K        4 \nVM_ALLOCATE                        1.0G       13 \n__AUTH                            2439K      274 \n__AUTH_CONST                      18.3M      451 \n__DATA                            15.3M      439 \n__DATA_CONST                      16.8M      457 \n__DATA_DIRTY                      1676K      193 \n__FONT_DATA                          4K        1 \n__LINKEDIT                       577.5M        5 \n__OBJC_CONST                      3231K      243 \n__OBJC_RO                         82.0M        1 \n__OBJC_RW                         3104K        1 \n__TEXT                           445.4M      475 \n__UNICODE                          588K        1 \n__XOJO                              16K        1 \ndyld private memory               1024K        1 \nmapped file                      150.0M       18 \nshared memory                      864K       14 \n===========                     =======  ======= \nTOTAL                              3.3G     2680 \nTOTAL, minus reserved VM space     2.6G     2680 \n",
  "legacyInfo" : {
  "threadTriggered" : {
    "queue" : "com.apple.main-thread"
  }
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "607844aa04477260f58a8077",
      "factorPackIds" : {
        "SIRI_MORPHUN_ASSETS" : "6103050cbfe6dc472e1c982a"
      },
      "deploymentId" : 240000066
    },
    {
      "rolloutId" : "60da5e84ab0ca017dace9abf",
      "factorPackIds" : {

      },
      "deploymentId" : 240000008
    },
    {
      "rolloutId" : "602ad4dac86151000cf27e46",
      "factorPackIds" : {
        "SIRI_DICTATION_ASSETS" : "61a80a438feb033580c2778b"
      },
      "deploymentId" : 240000290
    },
    {
      "rolloutId" : "5fc94383418129005b4e9ae0",
      "factorPackIds" : {

      },
      "deploymentId" : 240000207
    },
    {
      "rolloutId" : "5ffde50ce2aacd000d47a95f",
      "factorPackIds" : {

      },
      "deploymentId" : 240000098
    },
    {
      "rolloutId" : "601d9415f79519000ccd4b69",
      "factorPackIds" : {
        "SIRI_TEXT_TO_SPEECH" : "61f040507303d250981c88d9"
      },
      "deploymentId" : 240000377
    }
  ],
  "experiments" : [
    {
      "treatmentId" : "91be9c58-1d64-484d-b8d5-0bf7a6bb641c",
      "experimentId" : "60c785f07aa5af21f0101872",
      "deploymentId" : 400000012
    }
  ]
}
}

Model: MacBookPro18,1, BootROM 7429.61.2, proc 10:8:2 processors, 16 GB, SMC 
Graphics: Apple M1 Pro, Apple M1 Pro, Built-In
Display: Color LCD, 3456 x 2234 Retina, Main, MirrorOff, Online
Memory Module: LPDDR5
AirPort: Wi-Fi, wl0: Oct 25 2021 22:17:59 version 20.10.853.26.8.7.107 FWID 01-417a4935
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB31Bus
USB Device: USB31Bus
USB Device: USB31Bus
Thunderbolt Bus: MacBook Pro, Apple Inc.
Thunderbolt Bus: MacBook Pro, Apple Inc.
Thunderbolt Bus: MacBook Pro, Apple Inc.

Any idea how to fix this? It’s definitely the DesktopTextArea that has caused this breaking change.

Small typo in your code. Use this:

#If TargetCocoa Then
  Declare Function NSClassFromString Lib "AppKit" (aClassName As CFStringRef) As Ptr
  
  Var myTextArea As Ptr
  Declare Function documentView Lib "AppKit" Selector "documentView" _
    (obj_id As Ptr) As Ptr // use Ptr instead of Integer!
  
  myTextArea = documentView(t.Handle)
  
  Declare Sub setAutomaticQuoteSubstitutionEnabled Lib "AppKit" Selector "setAutomaticQuoteSubstitutionEnabled:" _
    (Id As Ptr, value As Boolean)
  
  setAutomaticQuoteSubstitutionEnabled (myTextArea, value)
#EndIf

or use MBS Xojo Plugins. Get a NSTextViewMBS from a TextArea and then set AutomaticQuoteSubstitutionEnabled property.

Ah I see, it’s AppKit I need to call. Great - thank you Martin.

1 Like

This is odd. I have @GarryPettet 's method too (although it also turns off dash and text substitutions), and it still has lib "Cocoa" everywhere.

Doesn’t crash at all either on Mojave on an intel Mini or Big Sur on an M1 Mini. I made no changes to this when I converted all TextAreas to DesktopTextAreas.

Am I missing something?