Skip to content

Commit

Permalink
Added a (hacky) fix for a Java Swing/AWT + GLFW interaction issue… (#968
Browse files Browse the repository at this point in the history
)

* 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. "
  • Loading branch information
Ali-RS authored and stephengold committed Dec 22, 2018
1 parent b5cb4c0 commit 8558dcb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,12 @@ public void actionPerformed(ActionEvent e) {
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();
}
}
});
Expand Down

0 comments on commit 8558dcb

Please sign in to comment.