diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2014-09-15 17:51:51 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2014-09-15 17:51:51 +0200 |
commit | 74ba65e918b50a49723023f78953f1babcf04e07 (patch) | |
tree | e877af64a564164243b880dfe14685de8f4ef099 /src/uca-camera.c | |
parent | 98bce3088c6a5ee7a0fd35f104ec62b61d3aca13 (diff) | |
download | libuca-74ba65e918b50a49723023f78953f1babcf04e07.tar.gz libuca-74ba65e918b50a49723023f78953f1babcf04e07.tar.bz2 libuca-74ba65e918b50a49723023f78953f1babcf04e07.tar.xz libuca-74ba65e918b50a49723023f78953f1babcf04e07.zip |
Fix race condition on buffered acquisition
Diffstat (limited to 'src/uca-camera.c')
-rw-r--r-- | src/uca-camera.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/uca-camera.c b/src/uca-camera.c index fbd251f..6f44957 100644 --- a/src/uca-camera.c +++ b/src/uca-camera.c @@ -707,24 +707,25 @@ uca_camera_stop_recording (UcaCamera *camera, GError **error) goto error_stop_recording; } + priv->is_recording = FALSE; + + if (priv->buffered) { + g_thread_join (priv->read_thread); + priv->read_thread = NULL; + } + g_static_mutex_lock (&access_lock); (*klass->stop_recording)(camera, &tmp_error); g_static_mutex_unlock (&access_lock); if (tmp_error == NULL) { priv->is_readout = FALSE; - priv->is_recording = FALSE; /* TODO: we should depend on GLib 2.26 and use g_object_notify_by_pspec */ g_object_notify (G_OBJECT (camera), "is-recording"); } else g_propagate_error (error, tmp_error); - if (priv->buffered) { - g_thread_join (priv->read_thread); - priv->read_thread = NULL; - } - if (camera->priv->ring_buffer != NULL) { g_object_unref (camera->priv->ring_buffer); camera->priv->ring_buffer = NULL; |