Improved stability of ext_ResetClass and ext_InitializeClass

This commit is contained in:
Elias Naur 2004-05-23 18:57:04 +00:00
parent bafbb8899b
commit 093cd19d82
3 changed files with 7 additions and 4 deletions

View File

@ -132,7 +132,7 @@ void doExtension(JNIEnv *env, jobject ext_set, const char *method_name, const ch
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 @@ static void ext_removeExtension(JNIEnv *env, jobject ext_set, const char *ext) {
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_InitializeFunctions(ExtGetProcAddressPROC gpa, int num_functions, ExtFu
}
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;

View File

@ -59,4 +59,4 @@ void extgl_InitEXTBlendEquationSeparate(JNIEnv *env, jobject ext_set)
jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/EXTBlendEquationSeparate");
if (extgl_Extensions.GL_EXT_blend_equation_separate)
extgl_InitializeClass(env, clazz, ext_set, "GL_EXT_blend_equation_separate", num_functions, functions);
}
}

View File

@ -726,7 +726,6 @@ bool extgl_Initialize(JNIEnv *env, jobject ext_set)
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 @@ bool extgl_Initialize(JNIEnv *env, jobject ext_set)
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);