From 656643c52299b0ade56428c9cab34c9d59727ff7 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Fri, 14 Jan 2022 09:08:23 +0100 Subject: [PATCH] call: Temporarily hold ref while setting new state This is needed to make sure the object stays alive, because some implementations will unref the call after it has been set to a disconnected state. This has become apparent because tests started failing when origins switched from the "state-changed" to the "notify::state" signal (as is done in the next commits). --- src/calls-call.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calls-call.c b/src/calls-call.c index b086586..1b15de6 100644 --- a/src/calls-call.c +++ b/src/calls-call.c @@ -390,11 +390,15 @@ calls_call_set_state (CallsCall *self, priv->state = state; + g_object_ref (G_OBJECT (self)); + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_STATE]); g_signal_emit_by_name (CALLS_CALL (self), "state-changed", state, old_state); + + g_object_unref (G_OBJECT (self)); } /**