alarm: Check proper cancellable from timer source ready callback
alarm: Check proper cancellable from timer source ready callback

on_timer_source_ready is called in two cases:

1) When the timer fires
2) When the input stream cancellable is cancelled

We attempt to check for this latter case up front at the start of the
function and react appropriately. We do this by checking if
self->priv->cancellable is cancelled.

Unforunately, checking self->priv->cancellable isn't always right,
because self->priv->cancellable isn't always the cancellable associated
with the input stream.  They can get out of sync, when for instance, the
alarm expiration time is changed. In this case the old input stream
cancellable will get cancelled, and self->priv->cancellable will get set
to the new cancellable.

This commit makes sure the on_timer_source_ready callback always checks
the cancellable associated with the input stream.  It accomplishes this
by allocating a GTask and using that as the callback data instead of
the alarm object directly.

https://bugzilla.gnome.org/show_bug.cgi?id=708975

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