Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Image] Error: invalid context 0x0 #1534

Closed
PhilippKrone opened this issue Jun 6, 2015 · 7 comments
Closed

[Image] Error: invalid context 0x0 #1534

PhilippKrone opened this issue Jun 6, 2015 · 7 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@PhilippKrone
Copy link
Contributor

Hello,

since upgrading to 0.5.0, I get a lot of the following errors, although everything seems to work as expected:

 <Error>: CGContextTranslateCTM: 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.
<Error>: CGContextScaleCTM: 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.
<Error>: CGContextDrawImage: 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.
 <Error>: 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.

Do you have any idea where this might come from? Else I'd start to disable one plugin after the other and see what might be causing this.

Thanks
Philipp

@PhilippKrone
Copy link
Contributor Author

Small update: it seems to happen whenever I navigator.push() away from a certain (quite complex) screen. However, it does not happen when i push() towards this screen.

Debugging shows it seems to be connected to the RCTImageDownloader (fe4b4c2). When you draw an image with height only, not specifying a width (width e.g. given by parent container), this error occurs. If you specify the width, its not occuring.

@PhilippKrone PhilippKrone changed the title Error: invalid context 0x0 [Image] Error: invalid context 0x0 Jun 6, 2015
@rxb
Copy link
Contributor

rxb commented Jun 15, 2015

Also seeing this. Happens when I push away from a screen that has an image with just flex: 1 as width, rather than an explicit width.

@sahrens
Copy link
Contributor

sahrens commented Jun 15, 2015

Nick is oncall this week and I have no idea what this error is.

@brentvatne
Copy link
Collaborator

Fair @sahrens 😄 - I don't have a clue either, we can wait for Nick then 👍

@grabbou
Copy link
Contributor

grabbou commented Jul 30, 2015

@nicklockwood Nick, have you had any luck with sorting that out? Not sure if I should debug these warnings and get them fixed by changing the styles or wait as the UI looks perfectly anyway.

@yusefnapora
Copy link
Contributor

Hey guys, I just made a PR for this: #2278 - it just adds a check to the RCTClipRect function to catch destination sizes where width or height are zero and calculates them based on the aspect ratio of the source image. Makes the scary warnings go away :)

vjeux pushed a commit to vjeux/react-native that referenced this issue Aug 11, 2015
… size == 0

Summary:
Addresses facebook#1534

When an image has a known width, but a height of 0 (which can happen if `flex: 1` is set on the `Image` element), `RCTDownloadManager` attempts to scale it to an invalid size, which results in a `NULL` `CGContextRef` and some scary warnings from UIKit:

```
 <Error>: CGContextTranslateCTM: 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.
```

This adds a check for zero width or height to the `RCTClipRect` function.  If either dimension is zero, it is calculated based on the aspect ratio of the source image.  This ensures that we don't try to create an invalid `CGContextRef`, and that images with an unknown dimension are still scaled, blended, etc.
Closes facebook#2278
Github Author: Yusef Napora <yusef@napora.org>
@ide
Copy link
Contributor

ide commented Aug 15, 2015

Merged in with 0.10.0-rc.

@ide ide closed this as completed Aug 15, 2015
@facebook facebook locked as resolved and limited conversation to collaborators Jul 22, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

9 participants