Added a (hacky) fix for a Java Swing/AWT + GLFW interaction issue… (#968)

* Added a (hacky) fix for a Java Swing/AWT + GLFW interaction issue… 

… on Linux.

* Added a proper comment

* Added an extra call to System.gc() as recommendation from lwjgl’s @Spasi

"Run System.gc(), at least two times. Not sure how AWT handles native
resources, maybe there’s a finalizable/PhantomRef-ed resource that is not
released immediately, but a subsequent GC triggers a (too late) free. "
accellbaker
Ali-RS 6 years ago committed by empirephoenix
parent d8acd30a27
commit a47b4a46ba
  1. 6
      jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java

@ -442,6 +442,12 @@ public final class SettingsDialog extends JFrame {
if (verifyAndSaveCurrentSelection()) { if (verifyAndSaveCurrentSelection()) {
setUserSelection(APPROVE_SELECTION); setUserSelection(APPROVE_SELECTION);
dispose(); dispose();
// System.gc() should be called to prevent "X Error of failed request: RenderBadPicture (invalid Picture parameter)"
// on Linux when using AWT/Swing + GLFW.
// For more info see: https://github.com/LWJGL/lwjgl3/issues/149, https://hub.jmonkeyengine.org/t/experimenting-lwjgl3/37275
System.gc();
System.gc();
} }
} }
}); });

Loading…
Cancel
Save