LOGD("Terminate sticker daemon");
g_hash_table_destroy(_monitoring_hash);
_monitoring_hash = NULL;
- g_list_free_full(consumer_list, free);
+ g_list_free(consumer_list);
consumer_list = NULL;
g_main_loop_quit(main_loop);
}
delete_monitoring_list(&_monitoring_hash, info->bus_name, info->watcher_id);
}
- if (g_list_find(consumer_list, info->bus_name))
- consumer_list = g_list_remove(consumer_list, info->bus_name);
+ GList *node = g_list_find_custom(consumer_list, info->bus_name, (GCompareFunc) strcmp);
+ if (node) {
+ consumer_list = g_list_delete_link(consumer_list, node);
+ }
if (info->bus_name)
free(info->bus_name);
if (_monitoring_hash == NULL)
_monitoring_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
- if (consumer_list == NULL)
- consumer_list = g_list_alloc();
-
GVariant *reply_body = NULL;
int ret = STICKERD_SERVER_ERROR_OPERATION_FAILED;
}
if ((CLIENT_LIB)c_lib == STICKER_CLIENT_LIB_CONSUMER)
- *consumer_list = g_list_append(*consumer_list, strdup((const char *)sender));
+ *consumer_list = g_list_append(*consumer_list, g_strdup((sender)));
LOGD("sender: %s, watcher: %d", sender, m_info->watcher_id);
monitoring_list = g_list_append(monitoring_list, list_bus_name);
g_variant_get(parameters, "(ii)", &c_lib, &watcher_id);
- if ((CLIENT_LIB)c_lib == STICKER_CLIENT_LIB_CONSUMER)
- *consumer_list = g_list_remove(*consumer_list, sender);
+ if ((CLIENT_LIB)c_lib == STICKER_CLIENT_LIB_CONSUMER) {
+ GList *node = g_list_find_custom(*consumer_list, sender, (GCompareFunc) strcmp);
+ if (node)
+ *consumer_list = g_list_delete_link(*consumer_list, node);
+ }
if (g_hash_table_lookup(*monitoring_hash, GUINT_TO_POINTER(watcher_id)) != NULL) {
g_bus_unwatch_name(watcher_id);