openal: Don't free native path too early (duh)
This commit is contained in:
parent
74ab4f7fa4
commit
b19f24ec61
|
@ -48,13 +48,13 @@ void *NativeGetFunctionPointer(const char *function) {
|
||||||
void tryLoadLibrary(JNIEnv *env, jstring path) {
|
void tryLoadLibrary(JNIEnv *env, jstring path) {
|
||||||
char *path_str = GetStringNativeChars(env, path);
|
char *path_str = GetStringNativeChars(env, path);
|
||||||
printfDebugJava(env, "Testing '%s'", path_str);
|
printfDebugJava(env, "Testing '%s'", path_str);
|
||||||
free(path_str);
|
|
||||||
handleOAL = dlopen(path_str, RTLD_LAZY);
|
handleOAL = dlopen(path_str, RTLD_LAZY);
|
||||||
if (handleOAL != NULL) {
|
if (handleOAL != NULL) {
|
||||||
printfDebugJava(env, "Found OpenAL at '%s'", path_str);
|
printfDebugJava(env, "Found OpenAL at '%s'", path_str);
|
||||||
} else {
|
} else {
|
||||||
throwException(env, "Could not load OpenAL library");
|
throwException(env, "Could not load OpenAL library");
|
||||||
}
|
}
|
||||||
|
free(path_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnLoadOpenAL() {
|
void UnLoadOpenAL() {
|
||||||
|
|
|
@ -93,12 +93,12 @@ void tryLoadLibrary(JNIEnv *env, jstring path) {
|
||||||
const char *path_str = (*env)->GetStringUTFChars(env, path, NULL);
|
const char *path_str = (*env)->GetStringUTFChars(env, path, NULL);
|
||||||
printfDebugJava(env, "Testing '%s'", path_str);
|
printfDebugJava(env, "Testing '%s'", path_str);
|
||||||
handleOAL = NSAddImage(path_str, NSADDIMAGE_OPTION_RETURN_ON_ERROR);
|
handleOAL = NSAddImage(path_str, NSADDIMAGE_OPTION_RETURN_ON_ERROR);
|
||||||
(*env)->ReleaseStringUTFChars(env, path, path_str);
|
|
||||||
if (handleOAL != NULL) {
|
if (handleOAL != NULL) {
|
||||||
printfDebugJava(env, "Found OpenAL at '%s'", path_str);
|
printfDebugJava(env, "Found OpenAL at '%s'", path_str);
|
||||||
} else {
|
} else {
|
||||||
throwException(env, "Could not load OpenAL library");
|
throwException(env, "Could not load OpenAL library");
|
||||||
}
|
}
|
||||||
|
(*env)->ReleaseStringUTFChars(env, path, path_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -55,12 +55,12 @@ void tryLoadLibrary(JNIEnv *env, jstring path) {
|
||||||
char *path_str = GetStringNativeChars(env, path);
|
char *path_str = GetStringNativeChars(env, path);
|
||||||
printfDebugJava(env, "Testing '%s'", path_str);
|
printfDebugJava(env, "Testing '%s'", path_str);
|
||||||
handleOAL = LoadLibrary(path_str);
|
handleOAL = LoadLibrary(path_str);
|
||||||
free(path_str);
|
|
||||||
if (handleOAL != NULL) {
|
if (handleOAL != NULL) {
|
||||||
printfDebugJava(env, "Found OpenAL at '%s'", path_str);
|
printfDebugJava(env, "Found OpenAL at '%s'", path_str);
|
||||||
} else {
|
} else {
|
||||||
throwException(env, "Could not load OpenAL library (%d)", GetLastError());
|
throwException(env, "Could not load OpenAL library (%d)", GetLastError());
|
||||||
}
|
}
|
||||||
|
free(path_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue