JDK-8211305 : GTK3: warning when running getGraphics methods of BufferedImage
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: openjfx11
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86_64
  • Submitted: 2018-09-28
  • Updated: 2018-10-01
  • Resolved: 2018-10-01
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
Linux Mint 19
java version "11" 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11+28)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)
JavaFx 11

A DESCRIPTION OF THE PROBLEM :
The call of the getGraphics method of BufferedImage in a JavaFx application generates the well-known warning: 
(java:7297): Gdk-WARNING **: 08:31:22.870: XSetErrorHandler() called with a GDK error trap pushed. Don't do that.


REGRESSION : Last worked in version 10.0.2

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the source code to see the warning in the console

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Not having a warning
ACTUAL -
A warning

---------- BEGIN SOURCE ----------
import java.awt.image.BufferedImage;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;

//Workaround: -Djdk.gtk.version=2		possibly related to: JDK-8156779
public class Fx11Warning extends Application{

	@Override
	public void start(Stage stage) throws Exception {
		BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_3BYTE_BGR);
		bi.getGraphics();		//Warning
		stage.setScene(new Scene(new Button("patate"), 200, 200));
		stage.show();
	}
	
	public static void main(String[] args) {
		launch();
	}
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
-Djdk.gtk.version=2

FREQUENCY : always



Comments
In JDK 10 and earlier, GTK 2 was the default. But from FX 11, GTK3 is now the default. So closing this as duplicate of JDK-8156779
01-10-2018