Recent

Author Topic: [SOLVED] SelectDirectory() no longer works in Catalina  (Read 1735 times)

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2032
  • Former Delphi 1-7, 10.2 user
[SOLVED] SelectDirectory() no longer works in Catalina
« on: August 13, 2019, 10:48:37 am »
Code: Pascal  [Select][+][-]
  1. SelectDirectory('Select the GCB chipdata folder','',selectedDir);
  2.  

and

Code: Pascal  [Select][+][-]
  1.  selDir := TSelectDirectoryDialog.Create(nil);
  2.  
  3.       Try
  4.            selDir.Title:='Select GCB data folder';
  5.            if selDir.Execute then
  6.                     selectedDir := selDir.FileName;
  7.            finally
  8.                     selDir.Free;
  9.            end;
  10.  

In Catalina Beta 5, SelectDirectory and (my second attempt) TSelectDirectoryDialog are both silently ignored. No problem for either under Mojave.

Checking the Catalina logs I find:

Code: [Select]
Heaviest stack for the main thread of the target process:
  416  start + 52 (PICinfo + 6516) [0x100001974]
  416  main + 38 (PICinfo + 6742) [0x100001a56]
  416  FPC_SYSTEMMAIN + 96 (PICinfo + 6656) [0x100001a00]
  416  FPC_SysEntry + 32 (PICinfo + 195120) [0x10002fa30]
  416  PASCALMAIN + 200 (PICinfo + 6952) [0x100001b28]
  416  FORMS$_$TAPPLICATION_$__$$_RUN + 95 (PICinfo + 308815) [0x10004b64f]
  416  COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPRUN$TAPPLICATIONMAINLOOP + 83 (PICinfo + 593891) [0x100090fe3]
  416  -[NSApplication run] + 658 (AppKit + 70902) [0x7fff29f9a4f6]
  416  -[TCocoaApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 136 (PICinfo + 592824) [0x100090bb8]
  416  FORMS$_$TAPPLICATION_$__$$_RUNLOOP + 79 (PICinfo + 308911) [0x10004b6af]
  416  FORMS$_$TAPPLICATION_$__$$_HANDLEMESSAGE + 45 (PICinfo + 307581) [0x10004b17d]
  416  COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPPROCESSMESSAGES + 29 (PICinfo + 594157) [0x1000910ed]
  416  COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPRUNMESSAGES$BOOLEAN$NSDATE + 120 (PICinfo + 594024) [0x100091068]
  416  -[TCocoaApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 215 (PICinfo + 592903) [0x100090c07]
  416  -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2962 (AppKit + 95142) [0x7fff29fa03a6]
  416  _DPSEventHandledByCarbon + 54 (AppKit + 136682) [0x7fff29faa5ea]
  416  _NSHandleCarbonMenuEvent + 215 (AppKit + 137085) [0x7fff29faa77d]
  416  _HandleMenuSelection2 + 452 (HIToolbox + 649868) [0x7fff2b97fa8c]
  383  MenuSelectCore(MenuData*, Point, double, unsigned int, OpaqueMenuRef**, unsigned short*) + 603 (HIToolbox + 650627) [0x7fff2b97fd83]
  383  FinishMenuSelection(SelectionData*, MenuResult*, MenuResult*) + 96 (HIToolbox + 648007) [0x7fff2b97f347]
  383  SendMenuItemSelectedEvent + 339 (HIToolbox + 648435) [0x7fff2b97f4f3]
  383  SendMenuCommandWithContextAndModifiers + 45 (HIToolbox + 648526) [0x7fff2b97f54e]
  383  SendHICommandEvent(unsigned int, HICommand const*, unsigned int, unsigned int, unsigned char, void const*, OpaqueEventTargetRef*, OpaqueEventTargetRef*, OpaqueEventRef**) + 368 (HIToolbox + 487476) [0x7fff2b958034]
  383  SendEventToEventTarget + 39 (HIToolbox + 154392) [0x7fff2b906b18]
  383  SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 338 (HIToolbox + 34400) [0x7fff2b8e9660]
  383  DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1419 (HIToolbox + 37521) [0x7fff2b8ea291]
  383  NSSLMMenuEventHandler + 908 (AppKit + 3099478) [0x7fff2a27db56]
  383  -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 101 (AppKit + 3647831) [0x7fff2a303957]
  383  -[NSMenu _internalPerformActionForItemAtIndex:] + 82 (AppKit + 3648269) [0x7fff2a303b0d]
  383  -[NSMenu performActionForItemAtIndex:] + 114 (AppKit + 3648392) [0x7fff2a303b88]
  383  -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 106 (AppKit + 3285634) [0x7fff2a2ab282]
  383  -[NSMenuItem _corePerformAction] + 312 (AppKit + 3286278) [0x7fff2a2ab506]
  383  -[NSApplication(NSResponder) sendAction:to:from:] + 299 (AppKit + 2939412) [0x7fff2a256a14]
  383  -[TCocoaMenuItem lclItemSelected:] + 66 (PICinfo + 2248722) [0x100225012]
  383  COCOAWSMENUS$_$TLCLMENUITEMCALLBACK_$__$$_ITEMSELECTED + 59 (PICinfo + 2247547) [0x100224b7b]
  383  LCLMESSAGEGLUE_$$_DELIVERMESSAGE$TOBJECT$formal$$INT64 + 277 (PICinfo + 2348677) [0x10023d685]
  383  SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal + 216 (PICinfo + 106264) [0x100019f18]
  383  MENUS$_$TMENUITEM_$__$$_DOCLICKED$formal + 56 (PICinfo + 2566536) [0x100272988]
  383  MENUS$_$TMENUITEM_$__$$_CLICK + 273 (PICinfo + 2564257) [0x1002720a1]
  381  MAIN_UNIT1$_$TFORM1_MAIN_$__$$_MENUITEM_OPENCLICK$TOBJECT + 485 (PICinfo + 353125) [0x100056365]
  381  DIALOGS_$$_SELECTDIRECTORY$ANSISTRING$ANSISTRING$ANSISTRING$$BOOLEAN + 68 (PICinfo + 3369412) [0x1003369c4]
  381  DIALOGS_$$_SELECTDIRECTORY$ANSISTRING$ANSISTRING$ANSISTRING$BOOLEAN$LONGINT$$BOOLEAN + 221 (PICinfo + 3369645) [0x100336aad]
  381  DIALOGS$_$TCOMMONDIALOG_$__$$_EXECUTE$$BOOLEAN + 290 (PICinfo + 3329330) [0x10032cd32]
  381  DIALOGS$_$TOPENDIALOG_$__$$_DOEXECUTE$$BOOLEAN + 93 (PICinfo + 3335981) [0x10032e72d]
  381  DIALOGS$_$TCOMMONDIALOG_$__$$_DOEXECUTE$$BOOLEAN + 84 (PICinfo + 3330532) [0x10032d1e4]
  381  COCOAWSDIALOGS$_$TCOCOAWSFILEDIALOG_$__$$_SHOWMODAL$TCOMMONDIALOG + 314 (PICinfo + 3428858) [0x1003451fa]
  381  +[NSSavePanel(Instantiation) _crunchyRawUnbonedPanel] + 75 (AppKit + 7398287) [0x7fff2a69738f]
  381  -[NSSavePanel init] + 80 (AppKit + 10584612) [0x7fff2a9a1224]
  381  -[NSPanel init] + 75 (AppKit + 3287394) [0x7fff2a2ab962]
  381  -[NSOpenPanel initWithContentRect:styleMask:backing:defer:] + 134 (AppKit + 10619223) [0x7fff2a9a9957]
  381  -[NSSavePanel initWithContentRect:styleMask:backing:defer:] + 150 (AppKit + 10584769) [0x7fff2a9a12c1]
  381  -[NSSavePanel _initBridgeAndStuff] + 406 (AppKit + 10582093) [0x7fff2a9a084d]
  381  -[NSCFRunLoopSemaphore wait] + 38 (ViewBridge + 25743) [0x7fff5f68748f]
  381  -[NSCFRunLoopSemaphore wait:] + 402 (ViewBridge + 26264) [0x7fff5f687698]
  381  +[NSCFRunLoopSemaphore _observe:whilePerforming:] + 597 (ViewBridge + 27285) [0x7fff5f687a95]
  381  __29-[NSCFRunLoopSemaphore wait:]_block_invoke + 302 (ViewBridge + 28312) [0x7fff5f687e98]
  381  __29-[NSCFRunLoopSemaphore wait:]_block_invoke_2 + 122 (ViewBridge + 28528) [0x7fff5f687f70]
  381  __CONSIDER_WHO_REQUESTED_THIS_WAIT_BEFORE_SENDING_BUG_TO_VIEWBRIDGE__ + 7 (ViewBridge + 523205) [0x7fff5f700bc5]
  381  __29-[NSCFRunLoopSemaphore wait:]_block_invoke_3 + 86 (ViewBridge + 41518) [0x7fff5f68b22e]
  381  invokeRunLoopInModeForDuration + 498 (ViewBridge + 29075) [0x7fff5f688193]
  381  __invokeRunLoopInModeForDuration_block_invoke_2 + 25 (ViewBridge + 29249) [0x7fff5f688241]
  381  CFRunLoopRunSpecific + 499 (CoreFoundation + 238675) [0x7fff2cd3f453]
  381  __CFRunLoopRun + 1695 (CoreFoundation + 241015) [0x7fff2cd3fd77]
  381  __CFRunLoopServiceMachPort + 322 (CoreFoundation + 243675) [0x7fff2cd407db]
  381  mach_msg_trap + 10 (libsystem_kernel.dylib + 4374) [0x7fff6479a116]
 *381  ipc_mqueue_receive_continue + 0 (kernel + 1178240) [0xffffff800031fa80]

Is this related to the removal of the Carbon framework and:

Quote
Deprecations

macOS frameworks are now thinned for the x86-64 architecture. Apps that execute i386 code now fail with the EBADARCH error code. The remaining stub frameworks are nonfunctional and exist only for compatibility purposes. (51236070)
« Last Edit: October 19, 2019, 05:00:36 am by trev »

Thaddy

  • Hero Member
  • *****
  • Posts: 16807
  • Ceterum censeo Trump esse delendam
Re: SelectDirectory() no longer works in Catalina
« Reply #1 on: August 13, 2019, 06:18:42 pm »
Seems a similar issue that arose with win-x86_64, where you could only write shell extensions in 64 bit code. Apart from changing to all 64 bit code, that Apple expects you to do, there's not much else we can do from the Lazarus side if that is the case.
Changing servers. thaddy.com may be temporary unreachable but restored when the domain name transfer is done.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2032
  • Former Delphi 1-7, 10.2 user
Re: SelectDirectory() no longer works in Catalina
« Reply #2 on: August 14, 2019, 01:50:22 am »
I am compiling all 64 bit code with the Cocoa widget set. If you look at the log snippet I posted, you will see calls to the Carbon framework (eg NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef)  which is indeed only 32 bit and either removed or non-functional in Catalina.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2032
  • Former Delphi 1-7, 10.2 user
Re: SelectDirectory() no longer works in Catalina
« Reply #3 on: August 20, 2019, 10:47:41 am »
Beta 6 resolved the issue.

 

TinyPortal © 2005-2018