question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

X Error of failed request: BadWindow (invalid Window parameter) with LWJGL3

See original GitHub issue

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

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  20 (X_GetProperty)
  Resource id in failed request:  0x4e0005b
  Serial number of failed request:  1332
  Current serial number in output stream:  1332

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Ali-RScommented, Mar 8, 2022

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!

1reaction
SylvainBertrandcommented, Mar 8, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

X Error of failed request: BadWindow (invalid ... - LWJGL Forum
Hey guys, I am not sure if this is related to GLFW or LWJGL and if it is a bug or not. But...
Read more >
BadWindow (invalid Window parameter) · Issue #361 - GitHub
When I run cargo run --example astroblasto, I get the following. Adding path "/home/cedwards/Documents/git/ggez/resources" X Error of failed ...
Read more >
Frmbld.sh Crashes X Error of failed request - My Oracle Support
X Error of failed request : BadWindow (invalid Window parameter) Major opcode of failed request: 8 (X_MapWindow) Resource id in failed ...
Read more >
X Error of failed request: BadWindow (invalid Window parame
I can start the Battlenet Client, but it doesnt continue, sometimes it tears the screen, sometimes nothing happen, but just the error below....
Read more >
[SOLVED] Jme3.5.0-alpha on armhf - Development ...
LegacyApplication handleError SEVERE: Failed to destroy context java.lang. ... X Error of failed request: BadWindow (invalid Window parameter) Major opcode ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found