Pārlūkot izejas kodu

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. "
Ali-RS 6 gadi atpakaļ
vecāks
revīzija
8558dcb44a

+ 6 - 0
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();
                 }
             }
         });