CGContextSetBaseCTM invalid context 0x0
This error occurs on OSX Lion >=10.7.4
(not on <=10.7.3
) when invoking JFrame.setIconImage(Image) on:
OSX 10.7.5 with Java 1.6.0_65-b14-462-11M4509
and also (as discussed on the Apple Mac OS X v10.7 Lion Support Community and java-dev list) on:
OSX 10.7.4 with Java 1.6.0_51-b11-457-11A459
OSX 10.7.4 with Java 1.6.0_31
OSX 10.7.4 with Java 1.7.0_04
It does not happen on:
OSX 10.8.4 with Java 1.6.0_51-b11-457-11M4509
Given the above information, this error is a bug in the native window implementation of OSX >=10.7.4 and <10.8, and is not a bug in Java.
I attempted to work around this issue by adjusting the timing of setting the JFrame icon, but it doesn't matter when the method is invoked, the error appears to be unavoidable if using JFrame.setIconImage
.
You don't give much information on where this happen in your code. On Mac, when you see this it's usually because you are trying to draw into a graphic context when you don't have one.
In Java I think this could happen when drawing something in a JPanel or other JComponent. For example, when adding an image to it.
As far as I know, Java JDK on OS X is provided by Apple. For what I've read this is a known issue not yet fixed by Apple.