CGBitmapContextCreateImage: invalid context
When drawing labels in a window (pretty basic), I get the following errors:
Fri Oct 22 21:18:24 MacBook.local TestApp[460] <Error>: CGContextConcatCTM: invalid context 0x0
Fri Oct 22 21:18:24 MacBook.local TestApp[460] <Error>: CGContextSetInterpolationQuality: invalid context 0x0
Fri Oct 22 21:18:24 MacBook.local TestApp[460] <Error>: CGContextDrawImage: invalid context 0x0
Fri Oct 22 21:18:24 MacBook.local TestApp[460] <Error>: CGBitmapContextCreateImage: invalid context 0x0
Most of the time these errors can be ignored, but some time they seem to result in the application crashing or the labels not being drawn.
I was curious how I can go about troubleshooting this. The offending code seems to be this (the 2nd label causes the messages):
var gaugeBackground = Titanium.UI.createImageView({
image:'gauge-na.png',
top:90,
left:10,
height:12,
align:'left',
width:100
});
Titanium.UI.currentWindow.add(gaugeBackground);
var labelGauge = Titanium.UI.createLabel({
align:'left',
width:itemValue,
height:12,
left:10,
top:90,
borderWidth:1,
borderColor:'gray',
backgroundImage:'gauge-value.png'
});
Titanium.UI.currentWindow.add(labelGauge);
This draws a label on top of a previously created label (to simulate a partially filled horizontal gauge).
As I mentioned earlier, sometimes running this code results in the application freezing, though it works most of the time. There definitely seems to be something odd going on.
Thanks for any suggestions.
4 Answers
-
yup move the backgroundImage to a view and add your label to that view
-
Hi there Ingmar,
I get these constantly - it's pretty annoying. but I've found that:
- They don't seem to indicate a functional issue in the app (although it can't be a good sign!)
- They are directly related to setting a backgroundImage to a label
Do you get the freezing if you remove the borderwidth and bordercolor from the second label?
cheers,
Chris. -
Hi there Ingmar,
I get these constantly - it's pretty annoying. but I've found that:
- They don't seem to indicate a functional issue in the app (although it can't be a good sign!)
- They are directly related to setting a backgroundImage to a label
Do you get the freezing if you remove the borderwidth and bordercolor from the second label?
cheers,
Chris. -
Thank you Chris.
You might be right, these messages are only fired when I set a background. I have another discussion open (http://developer.appcelerator.com/question/76231/bug-creating-two-imageviews-on-top-of-each-other-causes-freeze-every-time), and it seems the problem is not related to the background image.
Using the 1.5 SDK, the app now crashes instead of freezing.
I can remove all properties, and just create an empty label without any properties, and it will still freeze (v1.4) or crash (v1.5).
I'm just not sure what to do. My app is essentially finished, but I'm in limbo.
I also have a sample app that will illustrate this if you are interested?