goaidentity: Fix deadlock in goaalarm on_cancelled
goaidentity: Fix deadlock in goaalarm on_cancelled

Calling g_cancellable_disconnect in a cancelled handler causes a
deadlock. This happens here as in clear_scheduled_timer_wakeups we
destroy the cancellable source that emitted the cancelled signal.
(goaalarm: on_cancelled-> clear_scheduled_wakeups
-> clear_scheduled_timer_wakeups -> g_source_destroy
-> g_source_destroy_internal -> g_child_source_remove_internal
-> g_source_unref_internal -> cancellable_source_finalize
-> g_cancellable_disconnect).

Thus based on Matthew Barnes , evolution commit
c155b170bcf644ab2cdf7b11afdda0d9c100772e :
EPhotoCache: Fix deadlock when cancelling subtasks.

That is, we move the cancelled task into the main thread in an idle
source, to prevent the disconnect from happening inside the cancelled
handler.

Fixes: https://bugzilla.gnome.org/705395

dnohales/gnome-online-accounts,felipeborges/gnome-online-accounts,felipeborges/gnome-online-accounts,Distrotech/gnome-online-accounts,dnohales/gnome-online-accounts,halfline/gnome-online-accounts,dnohales/gnome-online-accounts,halfline/gnome-online-accounts,ritzk/gnome-online-accounts,felipeborges/gnome-online-accounts,ritzk/gnome-online-accounts,ritzk/gnome-online-accounts,Distrotech/gnome-online-accounts,Distrotech/gnome-online-accounts,halfline/gnome-online-accounts