Fix invalid ESource unref in on_client_connected()

This patch was written by Milan Crha.

The problem is that on_client_connected() expects the ESource being
references, but it's not. Similarly the self->clients expects the
ESource being inserted is referenced, but it's not. This causes too
early free of the ESource.

While reading the code, the expectation of on_client_connected() that
the source_object argument is an EClient descendant
(source = e_client_get_source (E_CLIENT (source_object));) is also
wrong, especially when this is called before
e_cal_client_connect_finish(). You should get the ESource from the
argument returned by the e_cal_client_connect_finish() and only if it's
not NULL. It can be NULL on error. That's yet another issue here,
client = E_CAL_CLIENT (e_cal_client_connect_finish (result, &error)); -
the typecast suggests that you expect always returned a non-NULL, but
it can be NULL on error, as said above.

Fixes #435
3 jobs for mcatanzaro/#435-gnome-3-32 in 5 minutes and 52 seconds (queued for 1 second)
Status Job ID Name Coverage
  Flatpak
passed #416856
flatpak

00:05:16

 
  Review
passed #416857
review

00:00:36

manual #416858
allowed to fail manual
stop_review