Crash when printing - I'm unable to recreate

Hello!

I have a single user that is reporting a consistent crash in a contract-application when trying to print. He says the crash occurs immediately when he clicks the “Print” button in one of my project’s windows that then calls

g = OpenPrinterDialog( ps, ow )

where ps is a PrinterSetup object and ow is the window in question.

The user says the printer dialog is never shown. The application immediately crashes. They sent me the a crash report, which narrows the crash down to the following:

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

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

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

VM Regions Near 0x8c:
–>
__TEXT 0000000000001000-0000000000b35000 [ 11.2M] r-x/rwx SM=COW /Applications/REDACTED.app/Contents/MacOS/REDACTED

Application Specific Information:
Performing @selector(performClick:) from sender XOJButton 0x16c19060

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.print.framework.PrintCore0x936c8717 PJCSessionHasApplicationSetPrinter + 6
1 com.apple.print.framework.Print.Private0x061ba9c2 0x61a2000 + 100802
2 com.apple.AppKit 0x925e6aee -[NSWindowController _windowDidLoad] + 671
3 com.apple.AppKit 0x92588e62 -[NSWindowController window] + 115
4 com.apple.AppKit 0x9280df2e -[NSPrintPanel beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo:] + 504
5 com.xojo.XojoFramework 0x00e687af 0xe4d000 + 112559
6 com.xojo.XojoFramework 0x00fb5e99 RuntimeOpenPrinterDialog + 212
7 com.searchwaresolutions.REDACTED0x00147e47 REALbasic.OpenPrinterDialog%o%oo + 79[/code]

I cut the crash report off at what I recognized as the OpenPrinterDialog call and redacted the application name as it is a private and confidential application for my user.

Other users using the same build of the application are not seeing the crash. This user says that the crash only occurs when logged in as a non-Administrator user. When logged in as an Administrator, everything works fine. I do not have access to the specific computer in question and can only go by what the user translates for me.

I have asked the user to try printing to a different printer, but have not yet heard back. In the meantime, does this ring a bell for anyone? I’m sure it its something specific to this particular computer (and even the account on that computer), but I’m looking for something more concrete to help them figure out where to look to correct.

If not, I understand, but I figure it couldn’t hurt to try.

Thank you!

Shot it the dark here…
All machines (yours and theirs) on the same level of macOS (ie… no Carbon vs Cocoa problems)?
32bit vs 64bit?
Do they have issues printing on that same machine from other apps (by you, or Apple or anyone?)
What kind of printer (local, networked)… how does it compare to your setup?

Remove as many “variables” and see whats left

Thanks for the reply @Dave S!

Their machines are all on 10.12.1 (the newest OS they have tested in their environment). Mine is on 10.12.4. The user tells me he has no issues printing from that account on that machine from other applications, just mine. The printer is a networked printer (a EFI Fiery RIP). I only have local printers here to test with, but, as indicated, have other users printing with no issues to the same printer over the same network.

Have they ever done a page setup and have a valid PrinterSetup string?

I had that thought. The application does show a page setup dialog at a different point and saves the PrinterSetup string. I had the user open the page setup dialog to save a new PrinterSetup string, which they tell me they did and it still crashes.

What happens if you don’t pass in the window so the printer dialog is modal?

After that…I’m out of ideas. If you could do a special build for them logging each step in the method and logging each value that might tell you something different.

Yeah, I’m already working on a build that logs each line. He’s agreed to test it, but will be out of his office for the next week, so it’ll be a bit before he gets a chance to try. Fortunately, the app is not mission-critical for him.

That’s a good idea about making the print dialog modal. I hadn’t thought of that.

Just out of curiosity…

How are you saving the printer setup string?

Is this user using the same printer as everyone else?

[quote=331647:@Greg O’Lone]Just out of curiosity…

How are you saving the printer setup string?[/quote]

Do you mean in-application? It is simply being stored in a string variable.

Yes.

[quote=331791:@Scott Crick]Do you mean in-application? It is simply being stored in a string variable.
[/quote]
I’m assuming you save it to a preference file somewhere. If you do that, store it as base64. The “string” could include nulls which could affect reading it later.

It is saved and is Base-64 encoded before doing so.

Ok, something else to check is if they’ve got the same version of the printer driver itself. Sounds silly, but I’ve seen this happen before.

I will do so when the user is back in the office (apparently, he’s out for several days). Thanks for the idea!