From 60c4e0a77865fa55cafefda46677ef67000527cc Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 10 May 2004 21:48:06 +0000 Subject: [PATCH] Linux: Don't free colormap before the window is destroyed --- src/native/linux/org_lwjgl_opengl_Window.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/native/linux/org_lwjgl_opengl_Window.cpp b/src/native/linux/org_lwjgl_opengl_Window.cpp index c165c362..d88c812a 100644 --- a/src/native/linux/org_lwjgl_opengl_Window.cpp +++ b/src/native/linux/org_lwjgl_opengl_Window.cpp @@ -59,6 +59,7 @@ static GLXContext context = NULL; // OpenGL rendering context static GLXWindow glx_window; static Atom delete_atom; +static Colormap cmap; static Window current_win; static int current_screen; static bool current_fullscreen; @@ -246,7 +247,6 @@ static void createWindow(JNIEnv* env, int screen, XVisualInfo *vis_info, jstring Window root_win; Window win; XSetWindowAttributes attribs; - Colormap cmap; int attribmask; current_screen = screen; @@ -262,11 +262,11 @@ static void createWindow(JNIEnv* env, int screen, XVisualInfo *vis_info, jstring attribs.background_pixel = 0xFF000000; attribmask = CWColormap | CWBackPixel | CWEventMask; if (fullscreen || undecorated) { + printf("Depth: %d\n", vis_info->depth); attribmask |= CWOverrideRedirect; attribs.override_redirect = True; } win = XCreateWindow(getDisplay(), root_win, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs); - XFreeColormap(getDisplay(), cmap); printfDebug("Created window\n"); current_win = win; Java_org_lwjgl_opengl_Window_nSetTitle(env, NULL, title); @@ -289,6 +289,7 @@ static void createWindow(JNIEnv* env, int screen, XVisualInfo *vis_info, jstring static void destroyWindow() { XDestroyWindow(getDisplay(), current_win); + XFreeColormap(getDisplay(), cmap); } int getCurrentScreen(void) {