From 8558dcb44ae6d9c4487144102eabf60640222067 Mon Sep 17 00:00:00 2001 From: Ali-RS Date: Fri, 14 Dec 2018 11:49:25 +0330 Subject: [PATCH] =?UTF-8?q?Added=20a=20(hacky)=20fix=20for=20a=20Java=20Sw?= =?UTF-8?q?ing/AWT=20+=20GLFW=20interaction=20issue=E2=80=A6=20(#968)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. " --- jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java b/jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java index e2d64c8b9..15e7aa76c 100644 --- a/jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java +++ b/jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java @@ -442,6 +442,12 @@ public final class SettingsDialog extends JFrame { if (verifyAndSaveCurrentSelection()) { setUserSelection(APPROVE_SELECTION); 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(); } } });