Commit 88c68deb authored by Philip Withnall's avatar Philip Withnall Committed by Olivier Crête
Browse files

socket: Avoid g_main_context_ref(NULL) calls using the default context

If (agent->main_context == NULL) the sockets are created with a NULL
main context, which they then try to ref. That does not end well.
parent f8063106
......@@ -101,6 +101,10 @@ nice_tcp_active_socket_new (GMainContext *ctx, NiceAddress *addr,
return NULL;
}
if (ctx == NULL) {
ctx = g_main_context_default ();
}
sock = g_slice_new0 (NiceSocket);
sock->priv = priv = g_slice_new0 (TcpActivePriv);
......
......@@ -147,6 +147,10 @@ nice_tcp_passive_socket_new (GMainContext *ctx, NiceAddress *addr,
}
g_object_unref (gaddr);
if (ctx == NULL) {
ctx = g_main_context_default ();
}
sock = g_slice_new0 (NiceSocket);
nice_address_set_from_sockaddr (&sock->addr, &name.addr);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment