From 872f7b0b4e7ddfbbe96612c4470466681df41aba Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 11 Oct 2023 13:35:16 +0200 Subject: [PATCH] JNI: convert to and from JNI types for callObjectMethod as well While we can probably deprecate this function, with the change of Q_DECLARE_JNI_CLASS'ed types to be QJniObjects we need to correctly translate from e.g. jobject to QJniObject. Amends 62cb5589b3723fe8162e190cd54d9c78929b98d2. Change-Id: Id3c23fc0724e2eff895029b694d418481abcb8e6 Reviewed-by: Assam Boudjelthia Reviewed-by: Petri Virkkunen --- src/corelib/kernel/qjniobject.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qjniobject.h b/src/corelib/kernel/qjniobject.h index 0ba7209b85..05db6f4414 100644 --- a/src/corelib/kernel/qjniobject.h +++ b/src/corelib/kernel/qjniobject.h @@ -148,7 +148,9 @@ public: { QtJniTypes::assertObjectType(); constexpr auto signature = QtJniTypes::methodSignature(); - return callObjectMethod(methodName, signature.data(), std::forward(args)...); + LocalFrame frame; + return frame.template convertFromJni(callObjectMethod(methodName, signature, + frame.convertToJni(std::forward(args))...)); } QJniObject callObjectMethod(const char *methodName, const char *signature, ...) const;