struct ofono_call *nc, *oc;
unsigned int num_active = 0;
unsigned int num_held = 0;
+ GSList *notify_calls = NULL;
if (!ok)
return;
} else if (nc && (oc == NULL || (nc->id < oc->id))) {
/* new call, signal it */
if (nc->type == 0)
- ofono_voicecall_notify(vc, nc);
+ notify_calls = g_slist_append(notify_calls, nc);
n = n->next;
} else {
if (memcmp(nc, oc, sizeof(struct ofono_call)) &&
!nc->type)
- ofono_voicecall_notify(vc, nc);
+ notify_calls = g_slist_prepend(notify_calls,
+ nc);
n = n->next;
o = o->next;
}
}
+ /*
+ * Disconnections were already reported, so process the rest of the
+ * notifications. Note that the new calls are placed at the end of the
+ * list, after other state changes
+ */
+ g_slist_foreach(notify_calls, voicecall_notify, vc);
+ g_slist_free(notify_calls);
+
g_slist_foreach(vd->calls, (GFunc) g_free, NULL);
g_slist_free(vd->calls);