noti = g_hash_table_lookup(noti_tbl, key);
if (!noti) {
noti = create_noti(key, cb, user_data);
- pthread_mutex_unlock(&vconf_lock);
if (!noti) {
+ pthread_mutex_unlock(&vconf_lock);
_close_for_noti();
return -1;
}
if (r == -1) {
LOGE("vconf_notify_key_changed: key '%s' add notify error %d",
key, errno);
- pthread_mutex_lock(&vconf_lock);
g_hash_table_remove(noti_tbl, key);
- pthread_mutex_unlock(&vconf_lock);
}
+ pthread_mutex_unlock(&vconf_lock);
/* increase reference count */
if (r == 0)
_open_for_noti();
}
cnt = unregister_noti(noti);
- pthread_mutex_unlock(&vconf_lock);
- if (cnt > 0)
+ if (cnt > 0) {
+ pthread_mutex_unlock(&vconf_lock);
return 0;
+ }
r = buxton_unregister_notification_sync(noti_client, get_layer(key),
key, notify_cb);
if (r == -1)
LOGE("unregister error '%s' %d", noti->key, errno);
- pthread_mutex_lock(&vconf_lock);
noti = g_hash_table_lookup(noti_tbl, key);
if (noti)
g_hash_table_remove(noti_tbl, key);