androidcamera: Small refactor in case open doesn't throw an exception but returns null

This commit is contained in:
Youness Alaoui 2012-11-29 20:10:19 -05:00 committed by Nicolas Dufresne
parent acfb1c44a7
commit 11b28224b5

View file

@ -1790,7 +1790,7 @@ gst_ah_camera_get_parameters (GstAHCamera * self)
GstAHCParameters *params = NULL;
object = AHC_CALL (return NULL, Object, getParameters);
if (object) {
params = g_slice_new0 (GstAHCParameters);
params->object = (*env)->NewGlobalRef (env, object);
(*env)->DeleteLocalRef (env, object);
@ -1800,6 +1800,7 @@ gst_ah_camera_get_parameters (GstAHCamera * self)
g_slice_free (GstAHCParameters, params);
return NULL;
}
}
return params;
}
@ -1822,7 +1823,7 @@ gst_ah_camera_open (gint camera_id)
GstAHCamera *camera = NULL;
object = AHC_STATIC_CALL (goto done, Object, open, camera_id);
if (object) {
camera = g_slice_new0 (GstAHCamera);
camera->object = (*env)->NewGlobalRef (env, object);
(*env)->DeleteLocalRef (env, object);
@ -1830,12 +1831,12 @@ gst_ah_camera_open (gint camera_id)
GST_ERROR ("Failed to create global reference");
(*env)->ExceptionClear (env);
g_slice_free (GstAHCamera, camera);
goto done;
camera = NULL;
}
}
return camera;
done:
return NULL;
return camera;
}
gboolean