JDK-8156779 : GTK3: warning when running SwingNode applications
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: 8u202,9,openjfx11
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2016-05-11
  • Updated: 2021-12-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Duplicate :  
Relates :  
Description
To reproduce, run any SwingNode application as follows:

$ java -Djdk.gtk.verbose=true -Djdk.gtk.version=3 ... MySwingNodeApp

Loading GTK libraries version 3
trying GTK library set libgtk-3.so.0, libgdk-3.so.0, libgdk_pixbuf-2.0.so.0
using GTK library set libgtk-3.so.0, libgdk-3.so.0, libgdk_pixbuf-2.0.so.0

(java:19742): Gdk-WARNING **: XSetErrorHandler() called with a GDK error trap pushed. Don't do that.

Comments
Bumping the priority now that GTK 3 is the default. We should resolve this for openjfx12 if possible. Also, we will need a backport to 8u once the GTK 3 backport is done (and ideally before GTK 3 is made the default for 8u).
01-10-2018

I could propose simply to remove #ifndef VERBOSE if (!noErrorTrap) { gdk_error_trap_push(); } #endif from the GlassApplication.cpp. But this may cause a non-zero probability for the process to die upon Xlib error, and so any Xlib call used inside gtk_main() should be protected with gdk_error_trap_push()/gdk_error_trap_pop(). Yet another possibility is to use XSetErrorHandler(0) instead gdk_error_trap_push(). I cannot judge which one is more suitable for FX, or maybe both are not suitable.
07-06-2016

taking this headache back. Will have to research the alternatives.
07-06-2016

It seems that XSetErrorHandler is unrelated to this warning. Aparently the issue is caused by an unusual gdk_error_trap_push() usage in GlassApplication.cpp: #ifndef VERBOSE if (!noErrorTrap) { gdk_error_trap_push(); } #endif gtk_main(); The gdk_error_trap_push()/gdk_error_trap_pop() are intended to be used in the next way: gdk_error_trap_push(); X...(); if (gdk_error_trap_pop()) {...} and the sequence like : gdk_error_trap_push(); gdk_error_trap_push(); will always produce this error. So, the first GTK3 call in the embedded AWT, which uses Xlib internally, is producing this message. It seems, this issue cannot be solved on the AWT side, even by a workaround, because it is impossible to detect if the gdk_error_trap_push() has been already called.
30-05-2016

From a comment in FX GlassApplication.cpp // GTK installs its own X error handler that conflicts with AWT. // During drag and drop, AWT hides errors so we need to hide them // to avoid exit()'ing. It's not clear that we don't want to hide // X error all the time, otherwise FX will exit(). // // A better solution would be to coordinate with AWT and save and // restore the X handler. // Disable X error handling #ifndef VERBOSE if (!noErrorTrap) { gdk_error_trap_push(); } #endif gtk_main(); Swing is usng XSetErrorHandler: [ddhill@ddhpad awt]$ grep XSetErrorHandler * gtk2_interface.c: handler = XSetErrorHandler(NULL); gtk2_interface.c: XSetErrorHandler(handler); gtk3_interface.c: handler = XSetErrorHandler(NULL); gtk3_interface.c: XSetErrorHandler(handler); with the comment: * gtk_init_check installs its own error handlers. It is critical that * we preserve error handler set from AWT. Otherwise we'll crash on * BadMatch errors which we would normally ignore. The IO error handler * is preserved here, too, just for consistency. Looks like this will not be a simple fix.
11-05-2016