[calls] call: Temporarily hold ref while setting new state



commit 656643c52299b0ade56428c9cab34c9d59727ff7
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Fri Jan 14 09:08:23 2022 +0100

    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 b0865863..1b15de66 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));
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]