Skip to content

Commit

Permalink
Ignore X errors after destroyWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
js6pak committed Feb 8, 2024
1 parent 6cc68d9 commit e3feb49
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/java/org/lwjgl/opengl/LinuxDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ final class LinuxDisplay implements DisplayImplementation {
private LinuxMouse mouse;

private String wm_class;

private static boolean destroying;

private final FocusListener focus_listener = new FocusListener() {
public void focusGained(FocusEvent e) {
Expand Down Expand Up @@ -334,7 +336,14 @@ private static int globalErrorHandler(long display, long event_ptr, long error_d

if (display == getDisplay()) {
String error_msg = getErrorText(display, error_code);
throw new LWJGLException("X Error - disp: 0x" + Long.toHexString(error_display) + " serial: " + serial + " error: " + error_msg + " request_code: " + request_code + " minor_code: " + minor_code);
LWJGLException exception = new LWJGLException("X Error - disp: 0x" + Long.toHexString(error_display) + " serial: " + serial + " error: " + error_msg + " request_code: " + request_code + " minor_code: " + minor_code);

if (destroying) {
exception.printStackTrace();
return 0;
}

throw exception;
} else if (saved_error_handler != 0)
return callErrorHandler(saved_error_handler, display, event_ptr);
return 0;
Expand Down Expand Up @@ -595,6 +604,8 @@ private void updateInputGrab() {
public void destroyWindow() {
lockAWT();
try {
destroying = true;

if (parent != null) {
parent.removeFocusListener(focus_listener);
}
Expand Down

0 comments on commit e3feb49

Please sign in to comment.