Android: Use Q_GLOBAL_STATIC instead of a static QMap
Change-Id: I7b65e0874051c4ef504914a0bd66e8471ec34fa7 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
03672d570d
commit
8a047ef087
@@ -48,18 +48,19 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
static jclass g_qtMediaRecorderListenerClass = 0;
|
static jclass g_qtMediaRecorderListenerClass = 0;
|
||||||
static QMap<jlong, JMediaRecorder*> g_objectMap;
|
typedef QMap<jlong, JMediaRecorder*> MediaRecorderMap;
|
||||||
|
Q_GLOBAL_STATIC(MediaRecorderMap, mediaRecorders)
|
||||||
|
|
||||||
static void notifyError(JNIEnv* , jobject, jlong id, jint what, jint extra)
|
static void notifyError(JNIEnv* , jobject, jlong id, jint what, jint extra)
|
||||||
{
|
{
|
||||||
JMediaRecorder *obj = g_objectMap.value(id, 0);
|
JMediaRecorder *obj = mediaRecorders->value(id, 0);
|
||||||
if (obj)
|
if (obj)
|
||||||
emit obj->error(what, extra);
|
emit obj->error(what, extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void notifyInfo(JNIEnv* , jobject, jlong id, jint what, jint extra)
|
static void notifyInfo(JNIEnv* , jobject, jlong id, jint what, jint extra)
|
||||||
{
|
{
|
||||||
JMediaRecorder *obj = g_objectMap.value(id, 0);
|
JMediaRecorder *obj = mediaRecorders->value(id, 0);
|
||||||
if (obj)
|
if (obj)
|
||||||
emit obj->info(what, extra);
|
emit obj->info(what, extra);
|
||||||
}
|
}
|
||||||
@@ -77,13 +78,13 @@ JMediaRecorder::JMediaRecorder()
|
|||||||
m_mediaRecorder.callMethod<void>("setOnInfoListener",
|
m_mediaRecorder.callMethod<void>("setOnInfoListener",
|
||||||
"(Landroid/media/MediaRecorder$OnInfoListener;)V",
|
"(Landroid/media/MediaRecorder$OnInfoListener;)V",
|
||||||
listener.object());
|
listener.object());
|
||||||
g_objectMap.insert(m_id, this);
|
mediaRecorders->insert(m_id, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JMediaRecorder::~JMediaRecorder()
|
JMediaRecorder::~JMediaRecorder()
|
||||||
{
|
{
|
||||||
g_objectMap.remove(m_id);
|
mediaRecorders->remove(m_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JMediaRecorder::release()
|
void JMediaRecorder::release()
|
||||||
|
|||||||
Reference in New Issue
Block a user