Change-Id: I11f4049f4141a6c87235b7b65ab6a7a101cb2abc
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
struct fd_handler_s {
int fd;
GIOChannel *ch;
+ GMainContext *context;
guint id;
fd_changed_cb changed;
void *data;
if (h->free_func)
h->free_func(h->data);
- if (h->id)
- g_source_remove(h->id);
+ if (h->id) {
+ GSource *source = g_main_context_find_source_by_id(h->context, h->id);
+ if (source)
+ g_source_destroy(source);
+ else
+ _I("Source ID %u was not found when attempting to remove it", h->id);
+ }
if (h->ch)
g_io_channel_unref(h->ch);
h->data = data;
h->free_func = free_func;
h->ch = ch;
+ h->context = context;
h->id = id;
h->handler_p = handler;
if (handler != NULL)