if (type_h->toolkit_table == NULL)
type_h->toolkit_table = g_hash_table_new_full(g_str_hash,
- g_str_equal, free, __destroy_toolkit_h);
+ g_str_equal, free, NULL);
g_hash_table_insert(type_h->toolkit_table, strdup(id), toolkit_h);
if (type_h->toolkit_table == NULL)
type_h->toolkit_table = g_hash_table_new_full(g_str_hash,
- g_str_equal, free, __destroy_toolkit_h);
+ g_str_equal, free, NULL);
g_hash_table_insert(type_h->toolkit_table, strdup(id), toolkit_h);
if (type_h->toolkit_table == NULL)
type_h->toolkit_table = g_hash_table_new_full(g_str_hash,
- g_str_equal, free, __destroy_toolkit_h);
+ g_str_equal, free, NULL);
g_hash_table_insert(type_h->toolkit_table, strdup(id), toolkit_h);
}
g_hash_table_remove(h->type_h->toolkit_table, h->instance_id);
-
+ __destroy_toolkit_h(h);
return 0;
}
return 0;
}
-static void __destroy_type_h(gpointer data)
-{
- screen_connector_type_evas_h type_h = (screen_connector_type_evas_h)data;
- if (!type_h)
- return;
-
- if (type_h->toolkit_table) {
- g_hash_table_destroy(type_h->toolkit_table);
- type_h->toolkit_table = NULL;
- }
- free(type_h);
-}
-
static void __cur_buffer_info_ref(cur_buffer_info_h info)
{
info->ref_count++;
free(toolkit_evas_h);
}
+static void __destroy_type_h(gpointer data)
+{
+ GHashTableIter iter;
+ gpointer key, value;
+ screen_connector_type_evas_h type_h = (screen_connector_type_evas_h)data;
+ if (!type_h)
+ return;
+
+ if (type_h->toolkit_table) {
+ g_hash_table_iter_init(&iter, type_h->toolkit_table);
+ while (g_hash_table_iter_next(&iter, &key, &value))
+ __destroy_toolkit_evas_h(value);
+
+ 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;
type_h = (screen_connector_type_evas_h)calloc(1, sizeof(struct _screen_connector_type_evas_h));
g_hash_table_insert(__type_table, GINT_TO_POINTER(type), type_h);
- type_h->toolkit_table = g_hash_table_new_full(g_str_hash, g_str_equal, free, __destroy_toolkit_evas_h);
+ type_h->toolkit_table = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL);
if (!type_h->toolkit_table) {
LOGE("failed to create table");
return -1;
EXPORT_API int screen_connector_toolkit_evas_fini(screen_connector_screen_type_e type)
{
screen_connector_type_evas_h type_h;
+ GHashTableIter iter;
+ gpointer key, value;
if (__type_table == NULL) {
LOGI("__type_table is NULL");
type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(type));
if (type_h) {
if (type_h->toolkit_table) {
+ g_hash_table_iter_init(&iter, type_h->toolkit_table);
+ while (g_hash_table_iter_next(&iter, &key, &value))
+ __destroy_toolkit_evas_h(value);
g_hash_table_destroy(type_h->toolkit_table);
type_h->toolkit_table = NULL;
}
LOGE("Null instance_id");
return -1;
}
+
g_hash_table_remove(handle->type_h->toolkit_table, instance_id);
+ __destroy_toolkit_evas_h(handle);
+
return 0;
}