Internal warning/failure appears not to be my code after all.
Internal warning/failure appears not to be my code after all.
- Subject: Internal warning/failure appears not to be my code after all.
- From: Graham Cox <email@hidden>
- Date: Mon, 12 Sep 2011 11:13:30 +1000
I get this warning logged when running in the debugger on Xcode 4.1 on Lion (not tried on Snow Leopard):
Sep 12 11:09:55 Grahams-iMac Artboard[9862] <Error>: CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 16 bits/pixel; 1-component color space; kCGImageAlphaPremultipliedFirst; 128 bytes/row.
2011-09-12 11:09:55.774 Artboard[9862:503] It does not make sense to draw an image when [NSGraphicsContext currentContext] is nil. This is a programming error. Break on _NSWarnForDrawingImageWithNoCurrentContext to debug. This will be logged only once. This may break in the future.
The stack trace is:
#0 0x00007fff89dc60b1 in _NSWarnForDrawingImageWithNoCurrentContext ()
#1 0x00007fff899cfcde in -[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:] ()
#2 0x00007fff89b4b745 in -[NSImageRep _newCGImageForProposedRect:context:hints:flipped:] ()
#3 0x00007fff89a3ddc5 in -[NSImageRep CGImageForProposedRect:context:hints:] ()
#4 0x00007fff89a03b16 in -[NSImageRep CGImageForProposedRect:context:hints:flipped:] ()
#5 0x00007fff89b4b3c3 in -[NSImage _newSnapshotRepForRep:rect:context:processedHints:] ()
#6 0x00007fff89a5b621 in -[NSImage _snapshotRepForRep:rect:context:processedHints:] ()
#7 0x00007fff899cf732 in __-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 ()
#8 0x00007fff899ce594 in -[NSImage _usingBestRepresentationForRect:context:hints:body:] ()
#9 0x00007fff899ce08e in -[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:] ()
#10 0x00007fff89a0106c in -[NSImage _drawMappingAlignmentRectToRect:withState:backgroundStyle:operation:fraction:flip:hints:] ()
#11 0x00007fff89f41934 in -[NSTextAttachmentCell drawWithFrame:inView:] ()
#12 0x00007fff89f42157 in -[NSTextAttachmentCell drawWithFrame:inView:characterIndex:] ()
#13 0x00007fff89f420fa in -[NSTextAttachmentCell drawWithFrame:inView:characterIndex:layoutManager:] ()
#14 0x00007fff89b4590f in -[NSLayoutManager(NSTextViewSupport) showAttachmentCell:inRect:characterIndex:] ()
#15 0x00007fff89de6387 in -[NSLayoutManager(NSPrivate) _drawGlyphsForGlyphRange:atPoint:parameters:] ()
#16 0x00000001003b7571 in -[DKTextAdornment drawText:withObject:withPath:layoutManager:] at /Users/grahamcox/Projects/DrawKit/DrawKit/../Source/Code/DKTextAdornment.m:1291
#17 0x00000001003b6b9e in -[DKTextAdornment drawText:withObject:withPath:] at /Users/grahamcox/Projects/DrawKit/DrawKit/../Source/Code/DKTextAdornment.m:1207
#18 0x00000001003b960a in -[DKTextAdornment render:] at /Users/grahamcox/Projects/DrawKit/DrawKit/../Source/Code/DKTextAdornment.m:1722
#19 0x00000001003c991d in -[DKTextShape drawContent] at /Users/grahamcox/Projects/DrawKit/DrawKit/../Source/Code/DKTextShape.m:1743
#20 0x00000001002c7544 in -[DKDrawableObject drawContentInRect:fromRect:withStyle:] at /Users/grahamcox/Projects/DrawKit/DrawKit/../Source/Code/DKDrawableObject.m:1799
#21 0x00000001002ca452 in -[DKDrawableObject rectHitsPath:] at /Users/grahamcox/Projects/DrawKit/DrawKit/../Source/Code/DKDrawableObject.m:3233
#22 0x00000001002ca7e3 in -[DKDrawableObject pointHitsPath:] at /Users/grahamcox/Projects/DrawKit/DrawKit/../Source/Code/DKDrawableObject.m:3267
#23 0x00000001002e8635 in -[DKDrawableShape hitPart:] at /Users/grahamcox/Projects/DrawKit/DrawKit/../Source/Code/DKDrawableShape.m:2787
#24 0x00000001003c9736 in -[DKTextShape hitPart:] at /Users/grahamcox/Projects/DrawKit/DrawKit/../Source/Code/DKTextShape.m:1712
#25 0x00000001003826a0 in -[DKSelectAndEditTool mouseDownAtPoint:targetObject:layer:event:delegate:] at /Users/grahamcox/Projects/DrawKit/DrawKit/../Source/Code/DKSelectAndEditTool.m:1261
#26 0x00000001003d07b9 in -[DKToolController mouseDown:] at /Users/grahamcox/Projects/DrawKit/DrawKit/../Source/Code/DKToolController.m:853
#27 0x0000000100305302 in -[DKDrawingView mouseDown:] at /Users/grahamcox/Projects/DrawKit/DrawKit/../Source/Code/DKDrawingView.m:1778
#28 0x00007fff89a4966e in -[NSWindow sendEvent:] ()
When it leaves my code at line #16, I have an NSAssert that verifies that the current graphics context is not nil. It's not.
It seems to me some internal code is attempting to construct a bitmap which fails because the parameter combination is illegal, then blindly sets that non-existent bitmap as the current context, which fails slightly further along.
This is during rendering of some text that contains an inline imbedded image. If the text has no such image, this warning/exception never fires. The text is being rendered into an offscreen bitmap context of my own for hit-testing purposes, which is definitely valid, and verified set as the current context. It's not a showstopper - the inline image is ignored for the purposes of hit-testing, but otherwise my code continues to run normally (it would be better if I could hit-test the inline image, but this error prevents it).
Anyone from Apple care to comment before I report it as a bug? I've been over this in some detail in my own code and as far as I can see it really is not my fault…
--Graham
_______________________________________________
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