diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-05-10 19:09:49 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-05-16 09:41:36 +0100 |
commit | 42360d0d279037ca3e3c1bc9f5c8692ff3252da9 (patch) | |
tree | d3fab93a9adeb0e518f5014b4a824bc02ec192bc | |
parent | 97f9f0576723448364ddd959f3fdc76affe6ca7f (diff) |
tp_base_connection_change_status: delay side-effects until all preconditions are checked
If the caller makes an invalid state change, we shouldn't allow the
status to be updated, for instance from DISCONNECTED to CONNECTED if
success and failure race with each other and failure wins, as seen in
fd.o #37078; we should just emit the critical warning and leave it
DISCONNECTED.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37079
Reviewed-by: Vivek Dasmohapatra <vivek@collabora.co.uk>
-rw-r--r-- | telepathy-glib/base-connection.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c index 8e5e0762..ad05abbf 100644 --- a/telepathy-glib/base-connection.c +++ b/telepathy-glib/base-connection.c @@ -2875,7 +2875,6 @@ tp_base_connection_change_status (TpBaseConnection *self, } prev_status = self->status; - self->status = status; /* make appropriate assertions about our state */ switch (status) @@ -2902,6 +2901,10 @@ tp_base_connection_change_status (TpBaseConnection *self, return; } + /* now that we've finished return_if_fail'ing, we can start to make + * the actual changes */ + self->status = status; + /* ref self in case user callbacks unref us */ g_object_ref (self); |