1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2025-01-07 12:25:31 +00:00

sip-origin: Keep sofia running to allow unregistering on dispose

sofia-sip needs to keep iterating its' main loop in order to
unregister as well as process the response from the server.

Closes: #554
This commit is contained in:
Evangelos Ribeiro Tzaras 2023-03-16 12:51:56 +01:00
parent 8b3eccd1b7
commit f7745f50bd

View file

@ -22,6 +22,9 @@
*
*/
#define WAIT_FOR_OFFLINE_MS 100
#define WAIT_FOR_OFFLINE_RETRIES 5
#define G_LOG_DOMAIN "CallsSipOrigin"
@ -1505,6 +1508,21 @@ static void
calls_sip_origin_dispose (GObject *object)
{
CallsSipOrigin *self = CALLS_SIP_ORIGIN (object);
gboolean su_step_timeout = FALSE;
guint i = 0;
if (!self->use_direct_connection && self->state == CALLS_ACCOUNT_STATE_ONLINE) {
go_online (CALLS_ACCOUNT (self), FALSE);
while (self->state != CALLS_ACCOUNT_STATE_OFFLINE && !su_step_timeout) {
su_root_step (self->ctx->root, WAIT_FOR_OFFLINE_MS);
if (i++ > WAIT_FOR_OFFLINE_RETRIES)
su_step_timeout = TRUE;
}
}
deinit_sip_account (self);
g_clear_pointer (&self->id, g_free);
g_clear_pointer (&self->own_ip, g_free);
@ -1514,11 +1532,6 @@ calls_sip_origin_dispose (GObject *object)
g_clear_pointer (&self->user, g_free);
g_clear_pointer (&self->password, g_free);
if (!self->use_direct_connection && self->state == CALLS_ACCOUNT_STATE_ONLINE)
go_online (CALLS_ACCOUNT (self), FALSE);
deinit_sip_account (self);
G_OBJECT_CLASS (calls_sip_origin_parent_class)->dispose (object);
}