From 8feec32e604b1d1e388903c6ccbf178a44c41b56 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 18 Feb 2005 09:26:32 +0000 Subject: [PATCH] Linux: native error handling fixes --- src/native/linux/org_lwjgl_opengl_Display.c | 7 +++++-- src/native/linux/org_lwjgl_opengl_Pbuffer.c | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/native/linux/org_lwjgl_opengl_Display.c b/src/native/linux/org_lwjgl_opengl_Display.c index 51046653..b6404f4c 100644 --- a/src/native/linux/org_lwjgl_opengl_Display.c +++ b/src/native/linux/org_lwjgl_opengl_Display.c @@ -710,11 +710,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateContext(JNIEnv return; } + bool result; if (USEGLX13) { - initWindowGLX13(env, pixel_format); + result = initWindowGLX13(env, pixel_format); } else { - initWindowGLX(env, pixel_format); + result = initWindowGLX(env, pixel_format); } + if (!result) + decDisplay(); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyContext(JNIEnv *env, jobject this) { diff --git a/src/native/linux/org_lwjgl_opengl_Pbuffer.c b/src/native/linux/org_lwjgl_opengl_Pbuffer.c index dd4c496e..c7a94403 100644 --- a/src/native/linux/org_lwjgl_opengl_Pbuffer.c +++ b/src/native/linux/org_lwjgl_opengl_Pbuffer.c @@ -156,10 +156,11 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreatePbuffer(JNIEnv PbufferInfo *buffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, handle_buffer); bool result; result = createPbufferUsingUniqueContext(env, buffer_info, pixel_format, width, height, buffer_attribs, shared_context); - if (!result) - return; - if (!checkXError(env)) { + if (!result) { decDisplay(); + return; + } + if (!checkXError(env)) { destroyPbuffer(buffer_info); return; }