зеркало из https://github.com/mozilla/gecko-dev.git
Bug 932692 - Check for uncaught exceptions after JNI calls followed by JNI calls. r=blassey
This commit is contained in:
Родитель
e6381043a1
Коммит
85ebed2d1c
|
@ -105,7 +105,7 @@ int32_t DeviceInfoAndroid::GetDeviceName(
|
|||
if (cid != NULL) {
|
||||
jobject javaDeviceNameObj = env->CallObjectMethod(javaCmDevInfoObject,
|
||||
cid, deviceNumber);
|
||||
if (javaDeviceNameObj == NULL) {
|
||||
if (javaDeviceNameObj == NULL || jniFrame.CheckForException()) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
"%s: Failed to get device name for device %d.",
|
||||
__FUNCTION__, (int) deviceNumber);
|
||||
|
@ -200,7 +200,7 @@ int32_t DeviceInfoAndroid::CreateCapabilityMap(
|
|||
// Call the java class and get an array with capabilities back.
|
||||
jobject javaCapabilitiesObj = env->CallObjectMethod(javaCmDevInfoObject,
|
||||
cid, capureIdString);
|
||||
if (!javaCapabilitiesObj) {
|
||||
if (!javaCapabilitiesObj || jniFrame.CheckForException()) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
"%s: Failed to call java GetCapabilityArray.",
|
||||
__FUNCTION__);
|
||||
|
|
|
@ -154,7 +154,12 @@ int32_t VideoCaptureAndroid::SetAndroidObjects(void* javaVM,
|
|||
env->CallStaticObjectMethod(g_javaCmDevInfoClass,
|
||||
cid, (int) -1,
|
||||
javaContext);
|
||||
if (!javaCameraDeviceInfoObjLocal) {
|
||||
bool exceptionThrown = env->ExceptionCheck();
|
||||
if (!javaCameraDeviceInfoObjLocal || exceptionThrown) {
|
||||
if (exceptionThrown) {
|
||||
env->ExceptionDescribe();
|
||||
env->ExceptionClear();
|
||||
}
|
||||
EARLY_WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, -1,
|
||||
"%s: could not create Java Capture Device info object",
|
||||
__FUNCTION__);
|
||||
|
@ -329,7 +334,7 @@ int32_t VideoCaptureAndroid::Init(const int32_t id,
|
|||
cid, (jint) id,
|
||||
(jlong) this,
|
||||
capureIdString);
|
||||
if (!javaCameraObjLocal) {
|
||||
if (!javaCameraObjLocal || jniFrame.CheckForException()) {
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, _id,
|
||||
"%s: could not create Java Capture object", __FUNCTION__);
|
||||
return -1;
|
||||
|
@ -372,6 +377,7 @@ VideoCaptureAndroid::~VideoCaptureAndroid() {
|
|||
"%s: Call DeleteVideoCaptureAndroid", __FUNCTION__);
|
||||
// Close the camera by calling the static destruct function.
|
||||
env->CallStaticVoidMethod(g_javaCmClass, cid, _javaCaptureObj);
|
||||
jniFrame.CheckForException();
|
||||
|
||||
// Delete global object ref to the camera.
|
||||
env->DeleteGlobalRef(_javaCaptureObj);
|
||||
|
|
Загрузка…
Ссылка в новой задаче