summaryrefslogtreecommitdiff
path: root/socket/tcp-bsd.c
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2011-09-20 23:08:21 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2011-09-20 23:52:05 -0400
commit5aa81a864c8b50c81e4cc8eff9708f0dacb7ce31 (patch)
tree52972d12ca6c785d3d401964a006eee0ebf94fda /socket/tcp-bsd.c
parenta41f0d63afbcdb3455a1636f393b2eaef53c6e8f (diff)
downloadlibnice-5aa81a864c8b50c81e4cc8eff9708f0dacb7ce31.tar.gz
Keep a ref on the GMainContext that are attached to
Diffstat (limited to 'socket/tcp-bsd.c')
-rw-r--r--socket/tcp-bsd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/socket/tcp-bsd.c b/socket/tcp-bsd.c
index c8a5c48..67aeb5e 100644
--- a/socket/tcp-bsd.c
+++ b/socket/tcp-bsd.c
@@ -164,7 +164,7 @@ nice_tcp_bsd_socket_new (NiceAgent *agent, GMainContext *ctx, NiceAddress *addr)
sock->priv = priv = g_slice_new0 (TcpPriv);
priv->agent = agent;
- priv->context = ctx;
+ priv->context = g_main_context_ref (ctx);
priv->server_addr = *addr;
priv->error = FALSE;
@@ -197,6 +197,9 @@ socket_close (NiceSocket *sock)
g_queue_foreach (&priv->send_queue, (GFunc) free_to_be_sent, NULL);
g_queue_clear (&priv->send_queue);
+ if (priv->context)
+ g_main_context_unref (priv->context);
+
g_slice_free(TcpPriv, sock->priv);
}