diff --git a/core/jni/android_view_InputChannel.cpp b/core/jni/android_view_InputChannel.cpp index c7998a169225f..1c6ead0f1086a 100644 --- a/core/jni/android_view_InputChannel.cpp +++ b/core/jni/android_view_InputChannel.cpp @@ -111,11 +111,12 @@ void android_view_InputChannel_setDisposeCallback(JNIEnv* env, jobject inputChan } static jobject android_view_InputChannel_createInputChannel(JNIEnv* env, - NativeInputChannel* nativeInputChannel) { + std::unique_ptr nativeInputChannel) { jobject inputChannelObj = env->NewObject(gInputChannelClassInfo.clazz, gInputChannelClassInfo.ctor); if (inputChannelObj) { - android_view_InputChannel_setNativeInputChannel(env, inputChannelObj, nativeInputChannel); + android_view_InputChannel_setNativeInputChannel(env, inputChannelObj, + nativeInputChannel.release()); } return inputChannelObj; } @@ -143,13 +144,13 @@ static jobjectArray android_view_InputChannel_nativeOpenInputChannelPair(JNIEnv* } jobject serverChannelObj = android_view_InputChannel_createInputChannel(env, - new NativeInputChannel(serverChannel)); + std::make_unique(serverChannel)); if (env->ExceptionCheck()) { return NULL; } jobject clientChannelObj = android_view_InputChannel_createInputChannel(env, - new NativeInputChannel(clientChannel)); + std::make_unique(clientChannel)); if (env->ExceptionCheck()) { return NULL; }