summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/jni/android_window_WindowInfosListener.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/jni/android_window_WindowInfosListener.cpp b/core/jni/android_window_WindowInfosListener.cpp
index aae2549df429..f2cbe8abae8b 100644
--- a/core/jni/android_window_WindowInfosListener.cpp
+++ b/core/jni/android_window_WindowInfosListener.cpp
@@ -22,6 +22,7 @@
#include <gui/DisplayInfo.h>
#include <gui/SurfaceComposerClient.h>
#include <nativehelper/JNIHelp.h>
+#include <nativehelper/ScopedLocalFrame.h>
#include <utils/Log.h>
#include "android_hardware_input_InputWindowHandle.h"
@@ -95,6 +96,7 @@ struct WindowInfosListener : public gui::WindowInfosListener {
JNIEnv* env = AndroidRuntime::getJNIEnv();
LOG_ALWAYS_FATAL_IF(env == nullptr, "Unable to retrieve JNIEnv in onWindowInfoChanged.");
+ ScopedLocalFrame localFrame(env);
jobject listener = env->NewGlobalRef(mListener);
if (listener == nullptr) {
// Weak reference went out of scope