Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f6068e6 authored by Jeff Brown's avatar Jeff Brown
Browse files

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
parent 5fd30540
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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: {