summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyunho Kang <hhstark.kang@samsung.com>2017-03-13 22:19:24 +0900
committerHyunho Kang <hhstark.kang@samsung.com>2017-03-13 22:20:55 +0900
commit505fb90a88d192f7a2311c49fc3693a4c2e82415 (patch)
treefa19528a26adeb3e7d4d0fd4893c0890dfe1a491
parenta2055827b01886f328bdb19e796f214c77b7129b (diff)
downloadscreen-connector-505fb90a88d192f7a2311c49fc3693a4c2e82415.tar.gz
screen-connector-505fb90a88d192f7a2311c49fc3693a4c2e82415.tar.bz2
screen-connector-505fb90a88d192f7a2311c49fc3693a4c2e82415.zip
Change-Id: Ifc796724e8db62557fab4c80e6e912dbe022f169 Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
-rw-r--r--screen_connector_watcher/src/screen_connector_toolkit.c19
-rw-r--r--screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c25
2 files changed, 22 insertions, 22 deletions
diff --git a/screen_connector_watcher/src/screen_connector_toolkit.c b/screen_connector_watcher/src/screen_connector_toolkit.c
index 98864ff..b9f31e4 100644
--- a/screen_connector_watcher/src/screen_connector_toolkit.c
+++ b/screen_connector_watcher/src/screen_connector_toolkit.c
@@ -154,8 +154,10 @@ static void __destroy_type_h(gpointer data)
if (type_h->aul_handle)
aul_screen_connector_remove_screen_viewer(type_h->aul_handle);
- if (type_h->toolkit_table)
+ if (type_h->toolkit_table) {
g_hash_table_destroy(type_h->toolkit_table);
+ type_h->toolkit_table = NULL;
+ }
free(type_h);
}
@@ -202,20 +204,17 @@ static void __aul_screen_viewer_cb(const char *appid, const char *instance_id,
EXPORT_API int screen_connector_toolkit_init(screen_connector_screen_type_e type)
{
int ret = 0;
- int *key;
screen_connector_type_h type_h;
ret = screen_connector_trs_init();
if (__type_table == NULL)
- __type_table = g_hash_table_new_full(g_int_hash, g_int_equal, free, __destroy_type_h);
+ __type_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, __destroy_type_h);
- type_h = g_hash_table_lookup(__type_table, &type);
+ type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(type));
if (type_h == NULL) {
- key = (int *)calloc(1, sizeof(int));
- *key = type;
type_h = (screen_connector_type_h)calloc(1, sizeof(struct _screen_connector_type_h));
- g_hash_table_insert(__type_table, key, type_h);
+ g_hash_table_insert(__type_table, GINT_TO_POINTER(type), type_h);
}
return ret;
@@ -231,9 +230,9 @@ EXPORT_API int screen_connector_toolkit_fini(screen_connector_screen_type_e type
return 0;
}
- type_h = g_hash_table_lookup(__type_table, &type);
+ type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(type));
if (type_h)
- g_hash_table_remove(__type_table, &type);
+ g_hash_table_remove(__type_table, GINT_TO_POINTER(type));
if (g_hash_table_size(__type_table) == 0) {
ret = screen_connector_trs_fini();
@@ -274,7 +273,7 @@ EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_add(screen_connec
return NULL;
}
- type_h = g_hash_table_lookup(__type_table, &type);
+ type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(type));
if (type_h == NULL) {
LOGE("type %d is not initialized !!", type);
return NULL;
diff --git a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c
index a442f36..35b864b 100644
--- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c
+++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c
@@ -61,26 +61,25 @@ static void __destroy_type_h(gpointer data)
if (!type_h)
return;
- if (type_h->toolkit_table)
+ if (type_h->toolkit_table) {
g_hash_table_destroy(type_h->toolkit_table);
+ type_h->toolkit_table = NULL;
+ }
free(type_h);
}
EXPORT_API int screen_connector_toolkit_evas_init(Evas_Object *win, screen_connector_screen_type_e type)
{
screen_connector_type_evas_h type_h;
- int *key;
if (__type_table == NULL)
- __type_table = g_hash_table_new_full(g_int_hash, g_int_equal, free, __destroy_type_h);
+ __type_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, __destroy_type_h);
- type_h = g_hash_table_lookup(__type_table, &type);
+ type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(type));
if (type_h == NULL) {
- key = (int *)calloc(1, sizeof(int));
- *key = type;
type_h = (screen_connector_type_evas_h)calloc(1, sizeof(struct _screen_connector_type_evas_h));
- g_hash_table_insert(__type_table, key, type_h);
+ g_hash_table_insert(__type_table, GINT_TO_POINTER(type), type_h);
type_h->toolkit_table = g_hash_table_new(g_direct_hash, g_direct_equal);
if (!type_h->toolkit_table) {
@@ -102,11 +101,13 @@ EXPORT_API int screen_connector_toolkit_evas_fini(screen_connector_screen_type_e
return 0;
}
- type_h = g_hash_table_lookup(__type_table, &type);
+ type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(type));
if (type_h) {
- if (type_h->toolkit_table)
+ if (type_h->toolkit_table) {
g_hash_table_destroy(type_h->toolkit_table);
- g_hash_table_remove(__type_table, &type);
+ type_h->toolkit_table = NULL;
+ }
+ g_hash_table_remove(__type_table, GINT_TO_POINTER(type));
}
if (g_hash_table_size(__type_table) == 0) {
@@ -582,7 +583,7 @@ EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add(scr
screen_connector_type_evas_h type_h;
int int_type = type;
- type_h = g_hash_table_lookup(__type_table, &int_type);
+ type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(int_type));
if (type_h == NULL) {
LOGE("type %d is not initialized !!", type);
return NULL;
@@ -830,7 +831,7 @@ EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add_by_
screen_connector_type_evas_h type_h;
char rid_str[32];
- type_h = g_hash_table_lookup(__type_table, &type);
+ type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(type));
if (type_h == NULL) {
LOGE("type %d is not initialized !!", type);
return NULL;