• 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: CGContextConcatCTM: invalid context 0x0. How to fix?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGContextConcatCTM: invalid context 0x0. How to fix?


  • Subject: Re: CGContextConcatCTM: invalid context 0x0. How to fix?
  • From: Dean Reyburn <email@hidden>
  • Date: Thu, 19 Sep 2013 10:58:58 -0400

I ran into this yesterday converting CoreFoundation to ObjC with XCode 5. The old CF call to CGContextDrawImage(context, rect, picname) did not throw anything into the console.

But when I replaced CGContextDrawImage() with a call to the UIImage method: [picname drawInRect:rect]; then I got:

CGContextRestoreGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

I was not calling CGContextRestoreGState() at all, at least not explicitly.

I fixed this by pushing and popping the context:

	UIGraphicsPushContext(context);
	[picname drawInRect:rect]; // picname here is a UIImage *
	UIGraphicsPopContext();

So it would seem that some ObjC objects such as UIImage are implemented with CF code under the skin.

Hope that helps,

-Dean

On Sep 19, 2013, at 3:31 AM, Gerriet M. Denkmann <email@hidden> wrote:

>> This is more a Cocoa question than an Xcode question, but here goes:
>>
>> The value of the first parameter to these functions are NULL. In the documentation, this parameter is called "CGContextRef c".
>> So make sure "c" is not NULL (and has a valid value).
>
> The problem: Xcode tells me I am nowhere using any of these functions. So what to do next?
>
> Gerriet.

1-888-SOFT-440  or 1-888-763-8440
Reyburn Piano Service, Inc.
http://www.reyburn.com


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: CGContextConcatCTM: invalid context 0x0. How to fix?
      • From: David Duncan <email@hidden>
References: 
 >CGContextConcatCTM: invalid context 0x0. How to fix? (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: CGContextConcatCTM: invalid context 0x0. How to fix? (From: Lennart Thelander <email@hidden>)
 >Re: CGContextConcatCTM: invalid context 0x0. How to fix? (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: Xcode 5.0
  • Next by Date: Re: 64-bit-compatible iOS targets don't build in Xcode 4
  • Previous by thread: : invalid context 0x0. How to fix?
  • Next by thread: Re: CGContextConcatCTM: invalid context 0x0. How to fix?
  • Index(es):
    • Date
    • Thread