From 02c5657a7d6d30c6e874e29a0adcc38b58a45b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Fri, 13 Feb 2015 12:18:33 +0100 Subject: Android: Fix local ref handling. We where allowing conversion from jobject to QJNIObject without taking ownership of the jobject. Since we are managing the JNI environment we should not allow conversions without having the option of taking ownership of the local ref. This is now done by making the conversions explicit, i.e., local refs are converted through QJNIObjectPrivate::fromLocalRef() and global refs through the QJNIObjectPrivate's jobject constructor. This change breaks SC, but the API is private and no usage have been found outside QtBase. Change-Id: I3175f171699ec3f8e65144aaebc6246bc6e5bb4d Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/corelib/io/qstandardpaths_android.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qstandardpaths_android.cpp b/src/corelib/io/qstandardpaths_android.cpp index 958b4ea486..50cba3135e 100644 --- a/src/corelib/io/qstandardpaths_android.cpp +++ b/src/corelib/io/qstandardpaths_android.cpp @@ -57,7 +57,7 @@ static QJNIObjectPrivate applicationContext() if (appCtx.isValid()) return appCtx; - QJNIObjectPrivate activity = QtAndroidPrivate::activity(); + QJNIObjectPrivate activity(QtAndroidPrivate::activity()); if (!activity.isValid()) return appCtx; @@ -131,7 +131,7 @@ static QString getExternalFilesDir(const char *directoryField = 0) if (!path.isEmpty()) return path; - QJNIObjectPrivate activity = QtAndroidPrivate::activity(); + QJNIObjectPrivate activity(QtAndroidPrivate::activity()); if (!activity.isValid()) return QString(); -- cgit v1.2.3