NSImage release causing NSPrintOperation problem
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.