From: Jiwoong Im Date: Wed, 14 Dec 2016 06:53:36 +0000 (+0900) Subject: using vconf_lock in restore_connection X-Git-Tag: accepted/tizen/3.0/common/20161216.122740^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a69dbcfc8f836f9dfaedcefee20b41cb8a8a183;p=platform%2Fcore%2Fsystem%2Fbuxton2.git using vconf_lock in restore_connection - To protect noti_tbl & client data in multi-thread situations Change-Id: Ic1d2d29a86bffdfd5872c74109e2e92e51d1be5e Signed-off-by: Jiwoong Im --- diff --git a/vconf-compat/vconf.c b/vconf-compat/vconf.c index 0fc431d..cc793b0 100644 --- a/vconf-compat/vconf.c +++ b/vconf-compat/vconf.c @@ -212,15 +212,24 @@ static void _restore_connection(enum buxton_status status, if (status != BUXTON_STATUS_CONNECTION_CLOSED) return; + pthread_mutex_lock(&vconf_lock); + if (!noti_tbl) { + _refcnt = 0; + pthread_mutex_unlock(&vconf_lock); + return; + } + buxton_close(client); r = buxton_open(&client, _restore_connection, NULL); if (r == -1) { _refcnt = 0; LOGE("Can't connect to buxton: %d", errno); + pthread_mutex_unlock(&vconf_lock); return; } g_hash_table_foreach(noti_tbl, (GHFunc)_restore_noti_cb, NULL); + pthread_mutex_unlock(&vconf_lock); } static int _open(void)