mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-06 11:35:32 +00:00
cleanup: Fix calls_origin_get_name() related memory leaks
Document calls_origin_get_name() correctly as transfer-full. Additionaly fix related memory leaks.
This commit is contained in:
parent
1543802c88
commit
fecdc1fff8
5 changed files with 16 additions and 9 deletions
|
@ -242,13 +242,16 @@ dial (CallsOrigin *origin,
|
|||
{
|
||||
CallsSipOrigin *self;
|
||||
nua_handle_t *nh;
|
||||
g_autofree char *name = NULL;
|
||||
|
||||
g_assert (CALLS_ORIGIN (origin));
|
||||
g_assert (CALLS_IS_SIP_ORIGIN (origin));
|
||||
|
||||
name = calls_origin_get_name (origin);
|
||||
|
||||
if (address == NULL) {
|
||||
g_warning ("Tried dialing on origin '%s' without an address",
|
||||
calls_origin_get_name (origin));
|
||||
name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -259,7 +262,7 @@ dial (CallsOrigin *origin,
|
|||
SOATAG_ACTIVE_AUDIO (SOA_ACTIVE_SENDRECV),
|
||||
TAG_END ());
|
||||
|
||||
g_debug ("Calling `%s'", address);
|
||||
g_debug ("Calling `%s' from origin '%s'", address, name);
|
||||
|
||||
add_call (CALLS_SIP_ORIGIN (origin), address, FALSE, nh);
|
||||
}
|
||||
|
|
|
@ -146,10 +146,12 @@ ussd_state_changed_cb (CallsManager *self,
|
|||
static void
|
||||
add_origin (CallsManager *self, CallsOrigin *origin)
|
||||
{
|
||||
g_autofree const char *name = NULL;
|
||||
g_assert (CALLS_IS_MANAGER (self));
|
||||
g_assert (CALLS_IS_ORIGIN (origin));
|
||||
|
||||
g_debug ("Adding origin %s (%p)", calls_origin_get_name (origin), origin);
|
||||
name = calls_origin_get_name (origin);
|
||||
g_debug ("Adding origin %s (%p)", name, origin);
|
||||
|
||||
g_signal_connect_swapped (origin, "call-added", G_CALLBACK (add_call), self);
|
||||
g_signal_connect_swapped (origin, "call-removed", G_CALLBACK (remove_call), self);
|
||||
|
@ -176,10 +178,12 @@ static void
|
|||
remove_origin (CallsManager *self, CallsOrigin *origin)
|
||||
{
|
||||
GListModel *origins;
|
||||
g_autofree const char *name = NULL;
|
||||
|
||||
g_return_if_fail (CALLS_IS_ORIGIN (origin));
|
||||
|
||||
g_debug ("Removing origin %s (%p)", calls_origin_get_name (origin), origin);
|
||||
name = calls_origin_get_name (origin);
|
||||
g_debug ("Removing origin %s (%p)", name, origin);
|
||||
|
||||
g_signal_handlers_disconnect_by_data (origin, self);
|
||||
|
||||
|
|
|
@ -163,13 +163,13 @@ dial_queued (CallsNewCallBox *self)
|
|||
}
|
||||
|
||||
|
||||
char *
|
||||
static char *
|
||||
get_origin_name (gpointer item,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_assert (CALLS_IS_ORIGIN (item));
|
||||
|
||||
return g_strdup (calls_origin_get_name (item));
|
||||
return calls_origin_get_name (item);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -96,10 +96,10 @@ calls_origin_default_init (CallsOriginInterface *iface)
|
|||
*
|
||||
* Get the user-presentable name of the origin.
|
||||
*
|
||||
* Returns: A string containing the name. The string must be freed by
|
||||
* Returns (transfer full): A string containing the name. The string must be freed by
|
||||
* the caller.
|
||||
*/
|
||||
DEFINE_ORIGIN_GETTER(name, const gchar *, NULL);
|
||||
DEFINE_ORIGIN_GETTER(name, char *, NULL);
|
||||
|
||||
/**
|
||||
* calls_origin_get_calls:
|
||||
|
|
|
@ -48,7 +48,7 @@ struct _CallsOriginInterface
|
|||
|
||||
typedef void (*CallsOriginForeachCallFunc) (gpointer param, CallsCall* call, CallsOrigin* origin);
|
||||
|
||||
const gchar * calls_origin_get_name (CallsOrigin *self);
|
||||
char * calls_origin_get_name (CallsOrigin *self);
|
||||
GList * calls_origin_get_calls (CallsOrigin *self);
|
||||
void calls_origin_foreach_call (CallsOrigin *self,
|
||||
CallsOriginForeachCallFunc callback,
|
||||
|
|
Loading…
Reference in a new issue