g_main_loop_run(worker->loop);
g_mutex_lock(&worker->mutex);
- if (anr_timer->tag)
- g_source_remove(anr_timer->tag);
+ if (anr_timer->tag) {
+ source = g_main_context_find_source_by_id(worker->context,
+ anr_timer->tag);
+ if (source && !g_source_is_destroyed(source))
+ g_source_destroy(source);
+
+ anr_timer->tag = 0;
+ }
g_list_free_full(worker->jobs, __destroy_job);
g_main_context_pop_thread_default(worker->context);
if (anr_timer->tag) {
source = g_main_context_find_source_by_id(worker->context,
anr_timer->tag);
- g_source_destroy(source);
+ if (source && !g_source_is_destroyed(source))
+ g_source_destroy(source);
+
anr_timer->tag = 0;
anr_timer->start_time = 0;
}