}
g_mutex_unlock(&cb_info->user_cb_mutex[event]);
+
+ CAM_LOG_DEBUG("done - event[%d]", event);
}
static gboolean __camera_idle_event_callback(gpointer data)
g_mutex_clear(&cb_info->mp_data_mutex);
g_mutex_clear(&cb_info->bridge_lock);
- for (i = 0 ; i < MUSE_CAMERA_EVENT_TYPE_NUM ; i++)
+ for (i = 0 ; i < MUSE_CAMERA_EVENT_TYPE_NUM ; i++) {
+ /* The mutex can be locked when the user callback is called in idle callback.
+ This code will wait until it's unlocked and avoid crash by clearing locked mutex. */
+ if (!g_mutex_trylock(&cb_info->user_cb_mutex[i])) {
+ CAM_LOG_WARNING("user_cb_mutex[%d] is locked somewhere", i);
+ g_mutex_lock(&cb_info->user_cb_mutex[i]);
+ }
+
+ g_mutex_unlock(&cb_info->user_cb_mutex[i]);
g_mutex_clear(&cb_info->user_cb_mutex[i]);
+ }
for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
g_mutex_clear(&cb_info->api_mutex[i]);