summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@digia.com>2014-04-03 17:26:05 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-15 16:46:49 +0200
commit60a911096f04b5159b99ad444bc9ad9aedf42eb8 (patch)
tree89e252d8ec2a594ec720b576d44942756d90f45d
parent8a047ef087cebba5953ad3ed7b2d99df7966b695 (diff)
downloadqtmultimedia-60a911096f04b5159b99ad444bc9ad9aedf42eb8.tar.gz
Android: Use QMutexLock in camera callbacks.
We should not release the locks before the native callbacks returns. Change-Id: Ia2691f6c5be66a3dcf371e48e3bac7498b401833 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
-rw-r--r--src/plugins/android/src/wrappers/jcamera.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/plugins/android/src/wrappers/jcamera.cpp b/src/plugins/android/src/wrappers/jcamera.cpp
index b0e9f89f3..f43e2308c 100644
--- a/src/plugins/android/src/wrappers/jcamera.cpp
+++ b/src/plugins/android/src/wrappers/jcamera.cpp
@@ -82,27 +82,24 @@ static QJNIObjectPrivate rectToArea(const QRect &rect)
// native method for QtCamera.java
static void notifyAutoFocusComplete(JNIEnv* , jobject, int id, jboolean success)
{
- g_objectMapMutex.lock();
+ QMutexLocker locker(&g_objectMapMutex);
JCamera *obj = g_objectMap.value(id, 0);
- g_objectMapMutex.unlock();
if (obj)
Q_EMIT obj->autoFocusComplete(success);
}
static void notifyPictureExposed(JNIEnv* , jobject, int id)
{
- g_objectMapMutex.lock();
+ QMutexLocker locker(&g_objectMapMutex);
JCamera *obj = g_objectMap.value(id, 0);
- g_objectMapMutex.unlock();
if (obj)
Q_EMIT obj->pictureExposed();
}
static void notifyPictureCaptured(JNIEnv *env, jobject, int id, jbyteArray data)
{
- g_objectMapMutex.lock();
+ QMutexLocker locker(&g_objectMapMutex);
JCamera *obj = g_objectMap.value(id, 0);
- g_objectMapMutex.unlock();
if (obj) {
QByteArray bytes;
int arrayLength = env->GetArrayLength(data);
@@ -114,9 +111,8 @@ static void notifyPictureCaptured(JNIEnv *env, jobject, int id, jbyteArray data)
static void notifyFrameFetched(JNIEnv *env, jobject, int id, jbyteArray data)
{
- g_objectMapMutex.lock();
+ QMutexLocker locker(&g_objectMapMutex);
JCamera *obj = g_objectMap.value(id, 0);
- g_objectMapMutex.unlock();
if (obj) {
QByteArray bytes;
int arrayLength = env->GetArrayLength(data);