Bug 598197 - Don't setup audio when we can't get the JNIEnv, r=kinetik,blassey a=blocking-fennec

This commit is contained in:
Michael Wu 2010-09-22 18:03:46 -07:00
Родитель 980f513ba4
Коммит d28449abf9
2 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -171,6 +171,9 @@ sa_stream_open(sa_stream_t *s) {
}
JNIEnv *jenv = GetJNIForThread();
if (!jenv)
return SA_ERROR_NO_DEVICE;
if ((*jenv)->PushLocalFrame(jenv, 4)) {
return SA_ERROR_OOM;
}
@ -208,6 +211,9 @@ sa_stream_destroy(sa_stream_t *s) {
}
JNIEnv *jenv = GetJNIForThread();
if (!jenv)
return SA_SUCCESS;
(*jenv)->DeleteGlobalRef(jenv, s->output_unit);
(*jenv)->DeleteGlobalRef(jenv, s->at_class);
free(s);

Просмотреть файл

@ -85,7 +85,9 @@ public:
}
static JNIEnv *JNIForThread() {
return sBridge->AttachThread();
if (NS_LIKELY(sBridge))
return sBridge->AttachThread();
return nsnull;
}
// The bridge needs to be constructed via ConstructBridge first,