Closed Ali-RS closed 1 year ago
Is this a regression, or did JME 3.4.1-stable have the same issue?
I believe it is not a regression. I can reproduce it with older versions too.
For what it worth, I have also submitted an issue on the LWJGL GitHub page: https://github.com/LWJGL/lwjgl3/issues/742
Got this response:
Using AWT/Swing together with GLFW is not really supported/possible, because both try to steal each other's OS/window message events. AWT is using its own window message loop to process the OS/window message events in its EDT thread and you are doing the same with glfwPollEvents/glfwWaitEvents.
Hi! I'm also struggling with the transition to LWJGL3 for an application of our own that uses JME and AWT/Swing. I've been trying to figure out various code examples that cause an application to crash when running on Linux (testing on Ubuntu 20.04) with Java 17 (using Azul Zulu OpenJDK 17.0.2). Here's one example that seems similar to what you're experiencing @Ali-RS :
package example;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import org.lwjgl.glfw.GLFW;
public class CodeSnippet
{
public static void main(String[] args)
{
new JFrame();
GLFW.glfwInit();
new JFileChooser().showOpenDialog(null);
}
}
When closing the dialog to open a file, the whole app terminates immediately with the following error message:
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 20 (X_GetProperty)
Resource id in failed request: 0x4a00020
Serial number of failed request: 1515
Current serial number in output stream: 1515
In this example, it seems enough to move the GLFW initialization to be the first thing to run to prevent the error from popping.
I'm still digging for solutions, as migrating away from Swing/AWT or JME is not viable solution for me.
In this example, it seems enough to move the GLFW initialization to be the first thing to run to prevent the error from popping.
That's interesting!
If I disable the JME Settings dialog with app.setShowSettings(false);
(so GLFW will be the first thing to get initialized) then opening/closing a Swing window after that seems to be working fine in my case as well.
@SylvainBertrand thanks for the update!
The error does not occur with the latest snapshot build (3.3.2 SNAPSHOT build 2) of LWJGL3.
Platform
Linux Mint x64 with Mesa (v20) graphics driver
JDK
AdoptOpenJDK 16
Bug description
When I open a swing window (e.g. JME error dialog) along with the GLFW window, the moment I close the swing window it crashes the app with the below error. I am using LWJGL 3.
Stacktrace or crash log output