A small percentage of my customers is experiencing crashes when invoking the vanilla Page Setup dialog in our document-based macOS AppKit app.
So far only AirPrint printers are affected though I cannot replicate the issue locally when printing to an AirPrint target.
As soon as the Page Setup dialog is invoked via the usual runPageLayout: method in NSDocument the crash occurs deep inside the system frameworks in the PJCCreateSuggestedPaper() method:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [16825]
VM Region Info: 0 is not in any region. Bytes before following region: 4402925568
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 1066f5000-1067ed000 [ 992K] r-x/r-x SM=COW ...M App
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 PrintCore 0x7ff81623d183 PJCCreateSuggestedPaper + 71
1 PrintingUI 0x12ab25b43 0x12aadb000 + 305987
2 PrintingUI 0x12ab259ef 0x12aadb000 + 305647
3 PrintingUI 0x12aaf24c3 0x12aadb000 + 95427
4 PrintingUI 0x12ab09ab6 0x12aadb000 + 191158
5 PrintingUI 0x12ab093af 0x12aadb000 + 189359
6 PrintingUI 0x12ab0fa85 0x12aadb000 + 215685
7 PrintingUI 0x12ab15c52 0x12aadb000 + 240722
8 AppKit 0x7ff80bc3b2af -[NSWindowController _windowDidLoad] + 548
9 AppKit 0x7ff80bc36f78 -[NSWindowController window] + 110
10 AppKit 0x7ff80c1767d4 -[NSPageLayout beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo:] + 217
11 AppKit 0x7ff80bfda3e7 __82-[NSDocument runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:]_block_invoke + 394
12 AppKit 0x7ff80c06fce2 -[NSDocument(NSDocumentSerializationAPIs) _performActivity:] + 1672
13 AppKit
0x7ff80c070e37 -[NSDocument(NSDocumentSerializationAPIs)
performActivityWithSynchronousWaiting:usingBlock:cancellationHandler:] +
431
14 AppKit 0x7ff80bfda257 -[NSDocument runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:] + 94
For the affected customers the crash is 100% reproducible.
As there is no application specific code whatsoever in any of the stack traces and the app is using vanilla NSDocument methods to run the Page Setup dialog this very much looks like a bug in macOS Ventura...
Any suggestions or workarounds highly appreciated!
Cheers,
Jay