• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Asynchronous use of NSPrinter, NSPrintInfo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Asynchronous use of NSPrinter, NSPrintInfo


  • Subject: Asynchronous use of NSPrinter, NSPrintInfo
  • From: Mike Blaguszewski <email@hidden>
  • Date: Tue, 4 Oct 2005 18:37:18 -0400

I'm working on an app (a Dashboard widget plugin, if it's relevant), that queries the name of the default printer and the last selected paper size, for display. This can take several seconds or more on some systems, so we had been doing it async, using +[NSThread detachNewThreadSelector:ToTarget:withObject:]. However, it's been crashing for some users in the following expression:

[NSArray arrayWithObjects:[[printInfo printer] name], [printInfo localizedPaperName], nil] // printInfo is an NSPrintInfo object

The backtrace is always the same:

0 ...e.print.framework.PrintCore 0x915c3b54 CPLCopyDefaultPrinterName + 148
1 ...e.print.framework.PrintCore 0x915cd3d4 OpaquePMPrinter::CacheDefaultPrinter() + 68
2 ...e.print.framework.PrintCore 0x915cd35c OpaquePMPrinter::GetCachedDefaultPrinter() + 32
3 ...e.print.framework.PrintCore 0x915cd2ec OpaquePMPrinter::IsDefault() + 24
4 ...e.print.framework.PrintCore 0x915ccb94 OpaquePMPrinter::IsFavorite() + 68
5 ...e.print.framework.PrintCore 0x915ccb3c PMPrinterIsFavorite + 44
6 ...e.print.framework.PrintCore 0x915c3638 OpaquePMPrintSession::SetCurrentPrinter() + 128
7 ...e.print.framework.PrintCore 0x915c3524 OpaquePMPrintSession::OpaquePMPrintSession[unified] (OpaquePMPrintSession*) + 236
8 ...e.print.framework.PrintCore 0x915c3344 PJCCreateSession (OpaquePMPrintSession**) + 68
9 ...e.print.framework.PrintCore 0x915c3268 PMCreateSession + 68
10 com.apple.AppKit 0x937ed05c -[NSPrintInfo (NSInternal) _printSessionForGetting] + 48
11 com.apple.AppKit 0x937ec614 -[NSPrintInfo (NSManagedAttributes) _objectForAttributeKey:] + 104
12 com.AmbrosiaSW.easyenvelopes 0x00449608 -[EEWPlugin sendPrinterInfo:] + 96 (bundle1.s:283)
13 com.apple.Foundation 0x9287cf34 forkThreadForFunction + 108
14 libSystem.B.dylib 0x9002c3d4 _pthread_body + 96


We're pretty sure it's a thread-safety problem at this point. Can anybody confirm? Is there a way to get this information asynchronously that is known to be safe? Using Carbon directly, perhaps?

Thanks,
--
Mike Blaguszewski / Ambrosia Software, Inc.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: testing exchangedata
  • Next by Date: newbie interface problem
  • Previous by thread: Re: Optimizing PDFKit
  • Next by thread: newbie interface problem
  • Index(es):
    • Date
    • Thread