Skip to content

Commit

Permalink
JNI: don't pass jobject by reference
Browse files Browse the repository at this point in the history
And definitely not by non-const reference.

Discovered during upcoming fixes for native function registration.

Task-number: QTBUG-132410
Pick-to: 6.9 6.8
Change-Id: I0ce8519f5a1f9f3caffefc53e6d93b52509bc439
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
vohi committed Dec 28, 2024
1 parent cfd3c84 commit 1b84970
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/corelib/platform/android/qandroiditemmodelproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ jobject QAndroidItemModelProxy::jni_sibling(JNIEnv *env, jobject object, jint ro
}

jboolean QAndroidItemModelProxy::jni_setData(JNIEnv *env, jobject object, JQtModelIndex index,
jobject &value, jint role)
jobject value, jint role)
{
const QModelIndex nativeIndex = QAndroidModelIndexProxy::qInstance(index);
const QVariant qValue = QAndroidTypeConverter::toQVariant(QJniObject(value));
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/platform/android/qandroiditemmodelproxy_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class Q_CORE_EXPORT QAndroidItemModelProxy : public QAbstractItemModel
JQtModelIndex bottomRight, QJniArray<jint> roles);
Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(jni_dataChanged)

static jboolean jni_setData(JNIEnv *env, jobject object, JQtModelIndex index, jobject &value,
static jboolean jni_setData(JNIEnv *env, jobject object, JQtModelIndex index, jobject value,
jint role);
Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(jni_setData)

Expand Down

0 comments on commit 1b84970

Please sign in to comment.