androidcamera: Make sure to not call any callbacks after stopping the camera

Fixes segfaults when rotating the device for example.
This commit is contained in:
Sebastian Dröge 2012-10-26 11:46:23 +02:00 committed by Nicolas Dufresne
parent 1a2bcc769c
commit f43897e839
2 changed files with 6 additions and 4 deletions

View file

@ -126,6 +126,7 @@ gst_ah_camera_on_preview_frame (JNIEnv * env, jclass klass, jbyteArray data,
{
GstAHCPreviewCallback cb = (GstAHCPreviewCallback) (gsize) callback;
if (cb)
cb (data, (gpointer) (gsize) user_data);
}
@ -135,6 +136,7 @@ gst_ah_camera_on_error (JNIEnv * env, jclass klass, jint error,
{
GstAHCErrorCallback cb = (GstAHCErrorCallback) (gsize) callback;
if (cb)
cb (error, (gpointer) (gsize) user_data);
}

View file

@ -139,8 +139,6 @@ gst_ahc_src_dispose (GObject * object)
{
GstAHCSrc *self = GST_AHC_SRC (object);
gst_ahc_src_close (self);
if (self->queue)
g_object_unref (self->queue);
self->queue = NULL;
@ -673,6 +671,8 @@ gst_ahc_src_stop (GstBaseSrc * bsrc)
if (self->camera) {
gst_data_queue_flush (self->queue);
self->start = FALSE;
gst_ah_camera_set_preview_callback_with_buffer (self->camera, NULL, NULL);
gst_ah_camera_set_error_callback (self->camera, NULL, NULL);
return gst_ah_camera_stop_preview (self->camera);
}
return TRUE;