From 9aefad3f09b15a43ac2a29ea53628f1bd11a2d70 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 13 Apr 2008 18:11:38 +0000 Subject: [PATCH] Linux: Some DRI drivers don't like to have the context destroyed before the window, even though the context is not current anymore. The destroy ordering in Display.destroy is now flipped as a workaround --- src/java/org/lwjgl/opengl/Display.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/java/org/lwjgl/opengl/Display.java b/src/java/org/lwjgl/opengl/Display.java index 007406cf..16b80616 100644 --- a/src/java/org/lwjgl/opengl/Display.java +++ b/src/java/org/lwjgl/opengl/Display.java @@ -310,13 +310,7 @@ public final class Display { } } - private static void destroyWindow() { - if (!window_created) { - return; - } - if (parent != null) { - parent.removeComponentListener(component_listener); - } + private static void releaseDrawable() { try { if (context != null && context.isCurrent()) { Context.releaseCurrentContext(); @@ -325,6 +319,16 @@ public final class Display { } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred while trying to release context: " + e); } + } + + private static void destroyWindow() { + if (!window_created) { + return; + } + if (parent != null) { + parent.removeComponentListener(component_listener); + } + releaseDrawable(); // Automatically destroy keyboard & mouse if (Mouse.isCreated()) { @@ -932,8 +936,9 @@ public final class Display { return; } - destroyWindow(); + releaseDrawable(); destroyContext(); + destroyWindow(); destroyPeerInfo(); x = y = -1; cached_icons = null;