Fixes #1815, don't release the LocalRef returned by SDL_AndroidGetActivity
This commit is contained in:
parent
cf8a84626b
commit
53c00d6cad
1 changed files with 7 additions and 2 deletions
|
@ -1130,13 +1130,18 @@ extern "C" void *SDL_AndroidGetJNIEnv()
|
||||||
return Android_JNI_GetEnv();
|
return Android_JNI_GetEnv();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The jobject returned by SDL_AndroidGetActivity is a local reference.
|
||||||
|
* It is the caller's responsibility to properly release it
|
||||||
|
* (using LocalReferenceHolder or manually with env->DeleteLocalRef)
|
||||||
|
*/
|
||||||
|
|
||||||
extern "C" void *SDL_AndroidGetActivity()
|
extern "C" void *SDL_AndroidGetActivity()
|
||||||
{
|
{
|
||||||
LocalReferenceHolder refs(__FUNCTION__);
|
|
||||||
jmethodID mid;
|
jmethodID mid;
|
||||||
|
|
||||||
JNIEnv *env = Android_JNI_GetEnv();
|
JNIEnv *env = Android_JNI_GetEnv();
|
||||||
if (!refs.init(env)) {
|
if (!env) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue