From 26622efe55a73cdb0f2faa92310533784083be3d Mon Sep 17 00:00:00 2001 From: Dusan Stevanovic Date: Wed, 20 May 2026 17:42:24 +0200 Subject: [PATCH 1/2] Use stored incoming event entries instead of using ones from new message --- src/wcall/wcall.c | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/src/wcall/wcall.c b/src/wcall/wcall.c index a4466818b..9863b81f1 100644 --- a/src/wcall/wcall.c +++ b/src/wcall/wcall.c @@ -600,29 +600,43 @@ static void icall_start_handler(struct icall *icall, } if (inst->processing_notifications && inst->incomingh) { + struct incoming_event *prev_ie; struct incoming_event *ie; - ie = find_pending_event(&inst->pending_eventl, userid_sender); - if (ie) { - list_unlink(&ie->le); + prev_ie = find_pending_event(&inst->pending_eventl, + userid_sender); + if (prev_ie) { + list_unlink(&prev_ie->le); } ie = mem_zalloc(sizeof(*ie), ie_destructor); - if (ie) { - str_dup(&ie->convid, wcall->convid); - ie->msg_time = msg_time; - str_dup(&ie->userid, userid_sender); - str_dup(&ie->clientid, clientid_sender); - ie->video_call = video; - ie->should_ring = should_ring; - ie->conv_type = conv_type; - ie->arg = inst; - - list_append(&inst->pending_eventl, &ie->le, ie); + if (!ie) { + warning("wcall(%p): incomingh: cannot allocate ie\n", + wcall); + return; + } + + str_dup(&ie->convid, wcall->convid); + ie->msg_time = msg_time; + str_dup(&ie->userid, + prev_ie ? prev_ie->userid : userid_sender); + str_dup(&ie->clientid, + prev_ie ? prev_ie->clientid : clientid_sender); + ie->video_call = prev_ie ? prev_ie->video_call : video; + ie->should_ring = + prev_ie ? prev_ie->should_ring : should_ring; + ie->conv_type = + prev_ie ? prev_ie->conv_type : conv_type; + ie->arg = inst; + + list_append(&inst->pending_eventl, &ie->le, ie); + + if (prev_ie) { + mem_deref(prev_ie); } return; } - + if (inst->incomingh) { if (inst->mm) { mediamgr_invoke_incomingh(inst->mm, From 82f4fe2e2bcb14e053c9d89188ef86590578deb8 Mon Sep 17 00:00:00 2001 From: Dusan Stevanovic Date: Wed, 20 May 2026 19:07:19 +0200 Subject: [PATCH 2/2] move order so we don't unlink prev_ie if new ie is not allocated --- src/wcall/wcall.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/wcall/wcall.c b/src/wcall/wcall.c index 9863b81f1..3f8502fc7 100644 --- a/src/wcall/wcall.c +++ b/src/wcall/wcall.c @@ -603,11 +603,6 @@ static void icall_start_handler(struct icall *icall, struct incoming_event *prev_ie; struct incoming_event *ie; - prev_ie = find_pending_event(&inst->pending_eventl, - userid_sender); - if (prev_ie) { - list_unlink(&prev_ie->le); - } ie = mem_zalloc(sizeof(*ie), ie_destructor); if (!ie) { warning("wcall(%p): incomingh: cannot allocate ie\n", @@ -615,6 +610,12 @@ static void icall_start_handler(struct icall *icall, return; } + prev_ie = find_pending_event(&inst->pending_eventl, + userid_sender); + if (prev_ie) { + list_unlink(&prev_ie->le); + } + str_dup(&ie->convid, wcall->convid); ie->msg_time = msg_time; str_dup(&ie->userid,