Fix JNI reference leak in NativeActivity. (DO NOT MERGE)

This change ensures that the native activity releases the KeyEvent
objects that it allocates since they will not be released
automatically and eventually the JNI slot table will overflow
and crash the process.

Bug: 3170494
Change-Id: I2ea527f056096fae9bc9e7685dccb56ec7a0e8b4
This commit is contained in:
Jeff Brown
2010-11-08 15:59:19 -08:00
parent 5fd3054048
commit 8f6068e63e

View File

@@ -580,6 +580,7 @@ static int mainWorkCallback(int fd, int events, void* data) {
code->env->CallVoidMethod(code->clazz,
gNativeActivityClassInfo.dispatchUnhandledKeyEvent, inputEventObj);
checkAndClearExceptionFromCallback(code->env, "dispatchUnhandledKeyEvent");
code->env->DeleteLocalRef(inputEventObj);
code->nativeInputQueue->finishEvent(keyEvent, true);
}
int seq;
@@ -589,6 +590,7 @@ static int mainWorkCallback(int fd, int events, void* data) {
code->env->CallVoidMethod(code->clazz,
gNativeActivityClassInfo.preDispatchKeyEvent, inputEventObj, seq);
checkAndClearExceptionFromCallback(code->env, "preDispatchKeyEvent");
code->env->DeleteLocalRef(inputEventObj);
}
} break;
case CMD_FINISH: {