• 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
Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect


  • Subject: Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect
  • From: David Duncan <email@hidden>
  • Date: Mon, 14 Apr 2008 12:30:44 -0700

On Apr 14, 2008, at 11:56 AM, Carter R. Harrison wrote:

cgback is a CGLayerRef instance variable that I setup when the view is inited. I use the following line:

cgback = CGLayerCreateWithContext(context, CGSizeMake([self bounds].size.width, [self bounds].size.height), NULL);

It's my understanding that I do not need to retain cgback with CFRetain(), but I do need to release cgback in my dealloc() method - which I'm doing.


Where is "context" coming from? CGLayers are made relative to an example context that they optimize themselves for, but at -init your view hasn't been drawn yet, so there is no context. I suspect that your getting something you very much do not expect.

In general if you want to use layers with views, you should create the layer on the first -drawRect: call rather than trying to have them around from -init forward.
--
David Duncan
Apple DTS Animation and Printing
email@hidden




_______________________________________________

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


  • Follow-Ups:
    • Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect
      • From: "Carter R. Harrison" <email@hidden>
References: 
 >EXC_BAD_ACCESS when calling CGContextDrawLayerInRect (From: "Carter R. Harrison" <email@hidden>)
 >Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect (From: Nathan Vander Wilt <email@hidden>)
 >Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect (From: "Carter R. Harrison" <email@hidden>)

  • Prev by Date: Re: "hooking" into another app
  • Next by Date: Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect
  • Previous by thread: Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect
  • Next by thread: Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect
  • Index(es):
    • Date
    • Thread