Crash during printing an offscreen image view
Crash during printing an offscreen image view
- Subject: Crash during printing an offscreen image view
- From: Ramakrishna Vavilala <email@hidden>
- Date: Tue, 9 Jun 2009 21:13:46 -0400
I have the following code:
NSPrintInfo* printInfo = [NSPrintInfo sharedPrintInfo];
NSSize size = [printInfo paperSize];
size.height -= ([printInfo topMargin] + [printInfo bottomMargin]);
size.width -= ([printInfo leftMargin] + [printInfo rightMargin]);
NSRect imageViewBounds;
imageViewBounds.origin = NSZeroPoint;
imageViewBounds.size = size;
NSImageView* imageView = [[NSImageView alloc] initWithFrame:imageViewBounds];
[imageView setImage:[self printableImage]];
[imageView setImageScaling:NSScaleProportionally];
BOOL result = [[NSPrintOperation printOperationWithView:imageView]
runOperation];
[imageView release];
It works and I get the required result a print dialog box is shown and
printing is performed. Here is the strange problem, when the printer
dialog box has the preview visible in it (by clicking the down button
in the dialog box besides the printer name) the code works fine.
However when the preview is not visible the application crashes.
Thread 0 Crashed:
0 libobjc.A.dylib 0x95537688 objc_msgSend + 24
1 com.apple.AppKit 0x90a632a8 -[NSView
_finalizeWithReferenceCounting] + 1080
2 com.apple.AppKit 0x90a62e44 -[NSView dealloc] + 46
3 com.apple.AppKit 0x90ad47db -[NSImageCacheView
dealloc] + 69
4 com.apple.Foundation 0x9166b45f NSPopAutoreleasePool + 431
5 com.apple.AppKit 0x90a6565c -[NSApplication run] + 892
Any ideas?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden