summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2010-11-08 15:59:19 -0800
committerJeff Brown <jeffbrown@google.com>2010-11-08 16:03:13 -0800
commit8f6068e63ec93c671412bafee44e69fb73adecf6 (patch)
tree2531ae3492bb66570479a050101fdb4cfdf3c9c3
parent5fd3054048b41b033700be3f30e4bca69f4f13a6 (diff)
downloadframeworks_base-8f6068e63ec93c671412bafee44e69fb73adecf6.zip
frameworks_base-8f6068e63ec93c671412bafee44e69fb73adecf6.tar.gz
frameworks_base-8f6068e63ec93c671412bafee44e69fb73adecf6.tar.bz2
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
-rw-r--r--core/jni/android_app_NativeActivity.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/jni/android_app_NativeActivity.cpp b/core/jni/android_app_NativeActivity.cpp
index 45fd5a0..ec172bb 100644
--- a/core/jni/android_app_NativeActivity.cpp
+++ b/core/jni/android_app_NativeActivity.cpp
@@ -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: {