EXC_BAD_ACCESS when calling CGContextDrawLayerInRect
EXC_BAD_ACCESS when calling CGContextDrawLayerInRect
- Subject: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect
- From: "Carter R. Harrison" <email@hidden>
- Date: Sun, 13 Apr 2008 10:15:42 -0400
Hi Everybody,
I'm delving into Quartz 2D programming for the first time so this is
probably a newb issue, but either way I'm stumped. I have a
controller that is calling several custom drawing methods in my custom
view. The drawing methods call Quartz and tell it to draw various
things to a CGLayer reference. My drawRect: method of the custom view
is responsible for taking the CGLayer and drawing it to the view. To
do this I'm using the CGContextDrawLayerInRect method of CGLayer:
CGContextRef context = [[NSGraphicsContext currentContext]
graphicsPort];
CGContextDrawLayerInRect(context, CGRectMake([self frame].origin.x,
[self frame].origin.y, [self frame].size.width, [self
frame].size.height), cgback);
cgback is a instance variable pointing to a CGLayer.
So my code works, the correct things are being drawn to my view (more
or less), but what happens is that after several seconds of use, the
app crashes and I get an EXC_BAD_ACCESS error. I know that this means
somewhere a variable was freed and I'm still trying to access it, but
the error is occurring within CGContextDrawLayerInRect and I have no
way of knowing exactly what variable this is since I don't have the
source. I'm not explicitly freeing any of the variables that are
being passed into CGContextDrawLayerInRect. So I'm really at a loss.
Has anybody experienced anything like this before? Here is my stack
trace. Thanks everybody!
#0 0xffff08a0 in __memcpy
#1 0x924aacdf in CGAccessSessionGetBytes
#2 0x925141dc in partial_get_bytes
#3 0x92513f8f in CGAccessSessionGetChunks
#4 0x924b8759 in img_raw_read
#5 0x92471481 in img_data_lock
#6 0x9246f529 in CGSImageDataLock
#7 0x92b085ef in ripc_AcquireImage
#8 0x92af6d4f in ripc_DrawImage
#9 0x92890ce4 in dle_ExecuteDisplayList
#10 0x92892511 in dle_Execute
#11 0x92892a2d in CGDisplayListDelegateDrawDisplayList
#12 0x928932c6 in dlr_DrawLayer
#13 0x92515204 in CGContextDrawLayerInRect
#14 0x00036f89 in -[RDCView drawRect:] at RDCView.m:129
_______________________________________________
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