|
From: Elias N. <eli...@us...> - 2004-05-23 18:57:15
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22601/src/native/common Modified Files: common_tools.cpp extgl.cpp Log Message: Improved stability of ext_ResetClass and ext_InitializeClass Index: extgl.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- extgl.cpp 18 May 2004 20:55:56 -0000 1.36 +++ extgl.cpp 23 May 2004 18:57:04 -0000 1.37 @@ -726,7 +726,6 @@ extgl_InitSupportedExtensions(env, ext_set); //extgl_InitEXTNurbsTesselator(env, ext_set); - /* first load the extensions */ extgl_InitARBBufferObject(env, ext_set); extgl_InitARBImaging(env, ext_set); @@ -781,7 +780,7 @@ extgl_InitATIVertexAttribArrayObject(env, ext_set); extgl_InitATIVertexStreams(env, ext_set); - /* now load core opengl */ + /* now load core opengl */ extgl_InitOpenGL1_2(env, ext_set); extgl_InitOpenGL1_3(env, ext_set); extgl_InitOpenGL1_4(env, ext_set); Index: common_tools.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- common_tools.cpp 23 May 2004 13:50:08 -0000 1.19 +++ common_tools.cpp 23 May 2004 18:57:02 -0000 1.20 @@ -132,7 +132,7 @@ return; jstring ext_string = env->NewStringUTF(ext); if (ext_string == NULL) { - printf("Could not allocate java string from %s\n", ext); + printfDebug("Could not allocate java string from %s\n", ext); return; } env->CallBooleanMethod(ext_set, id, ext_string); @@ -144,6 +144,8 @@ jclass ext_ResetClass(JNIEnv *env, const char *class_name) { jclass clazz = env->FindClass(class_name); + if (clazz == NULL) + return NULL; jint result = env->UnregisterNatives(clazz); if (result != 0) printfDebug("Could not unregister natives for class %s\n", class_name); @@ -165,6 +167,8 @@ } bool ext_InitializeClass(JNIEnv *env, jclass clazz, jobject ext_set, const char *ext_name, ExtGetProcAddressPROC gpa, int num_functions, JavaMethodAndExtFunction *functions) { + if (clazz == NULL) + return false; JNINativeMethod *methods = (JNINativeMethod *)malloc(num_functions*sizeof(JNINativeMethod)); for (int i = 0; i < num_functions; i++) { JavaMethodAndExtFunction *function = functions + i; |