From 352a7852f65a1c82fb15103b69417ae9aed6c294 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Mon, 10 Oct 2022 09:59:02 +0200 Subject: [PATCH] ui-call-data: Prevent timer being started multiple times Fixes #502 --- src/calls-ui-call-data.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/calls-ui-call-data.c b/src/calls-ui-call-data.c index e824e29..a11f88e 100644 --- a/src/calls-ui-call-data.c +++ b/src/calls-ui-call-data.c @@ -264,7 +264,12 @@ set_state (CallsUiCallData *self, cui_call_state_to_string (old_state), cui_call_state_to_string (new_state)); - if (new_state == CUI_CALL_STATE_ACTIVE) { + /* Check for started timer, because state could have changed like this: + * ACTIVE -> HELD -> ACTIVE + * and we don't want to start the timer multiple times + */ + if (new_state == CUI_CALL_STATE_ACTIVE && !self->timer) { + self->timer = g_timer_new (); self->timer_id = g_timeout_add (500, G_SOURCE_FUNC (on_timer_ticked),