Fix issue related to noti_tbl hash table 55/73155/2 accepted/tizen/common/20160610.175821 accepted/tizen/ivi/20160609.090151 accepted/tizen/mobile/20160609.090122 accepted/tizen/tv/20160609.090225 accepted/tizen/wearable/20160609.090139 submit/tizen/20160608.045259
authorSemun Lee <sm79.lee@samsung.com>
Tue, 7 Jun 2016 03:53:23 +0000 (12:53 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Wed, 8 Jun 2016 02:22:40 +0000 (19:22 -0700)
- fix wrong copy_noti loop
- remove noti from noti_tbl after unregister noti completely

Change-Id: Ifd18061783b2c5f2f147dd6c769b6716189be7ba
Signed-off-by: Semun Lee <sm79.lee@samsung.com>
lib/buxton2.c
vconf-compat/vconf.c

index bc19df5..1898eee 100644 (file)
@@ -425,8 +425,7 @@ static GList *copy_noti_callbacks(GList *callbacks)
                return NULL;
 
        for (l = callbacks; l; l = g_list_next(l)) {
-               struct bxt_noti_cb *noticb;
-               noticb = callbacks->data;
+               struct bxt_noti_cb *noticb = l->data;
                noticb->ref_cnt++;
        }
        copy = g_list_copy(callbacks);
index 3de1328..9ad157f 100644 (file)
@@ -307,8 +307,7 @@ static GList *copy_noti_list(GList *noti_list)
 
        pthread_mutex_lock(&vconf_lock);
        for (l = noti_list; l; l = g_list_next(l)) {
-               struct noti_cb *noticb;
-               noticb = noti_list->data;
+               struct noti_cb *noticb = l->data;
                noticb->ref_cnt++;
        }
        copy = g_list_copy(noti_list);
@@ -511,8 +510,6 @@ static int unregister_noti(struct noti *noti)
        if (cnt > 0)
                return cnt;
 
-       g_hash_table_remove(noti_tbl, noti->key);
-
        return 0;
 }
 
@@ -560,6 +557,12 @@ EXPORT int vconf_ignore_key_changed(const char *key, vconf_callback_fn 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);
+       pthread_mutex_unlock(&vconf_lock);
+
        /* decrease reference count */
        _close_for_noti();