• 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
NSImage release causing NSPrintOperation problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSImage release causing NSPrintOperation problem


  • Subject: NSImage release causing NSPrintOperation problem
  • From: Brock Brandenberg <email@hidden>
  • Date: Sat, 15 Feb 2003 01:02:06 -0600

Has anyone encountered an issue where an NSImage release sent immediately
after an NSPrintOperation runOperation or an NSView dataWithPDFInsideRect:
method has completed, results in a bad PDF file written to disk?

I have a batch process where a persistent view will draw an NSImage that is
allocated and initialized with an NSPDFImageRep representation, then a print
operation is set up and run, specifying this view to be saved to a file with
an NSPrintSaveJob disposition. After the runOperation method completes, the
NSImage is released (along with its retained representation) and a new
NSImage is allocated and intialized, and the process repeats.

My results are oddly random. Sometimes I get good PDF files, sometimes they
are all blank when viewed in Preview even though the file contains data (as
opening the file in Illustrator will show) and sometimes some are good and
some are bad. The NSPrintOperation completes successfully, no crashes occur
even in hundreds of iterations and memory consumption is stable.

The problem can be fixed by calling autorelease on the NSImage instead of
release. Very odd. It acts as though there is really an asynchronous
operation going on behind the scenes and the NSImage release is dealloc'ing
the image before the print operation is really finished. The autorelease
seems to give the job "more time" to finish.

I can't find any tech notes on the issue nor any relevant messages in all
the forums. Any pointers?

Thanks,
Brock Brandenberg

----- industrial design @ www.bergdesign.com ------
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: embedding libraries
  • Next by Date: Re: Newbie question about NSOutlineView
  • Previous by thread: Re: Newbie question about NSOutlineView
  • Next by thread: Re: NSImage release causing NSPrintOperation problem
  • Index(es):
    • Date
    • Thread