diff options
author | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2009-08-10 16:30:53 -0400 |
---|---|---|
committer | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2009-08-10 16:34:09 -0400 |
commit | a28b0e0be8c211c21c0a0158e4e7fb18750c1be1 (patch) | |
tree | 9691a2e09dce457ba619162d7410f8eaaede2a64 /gst | |
parent | b5b35e85a153bc830438e2bf110f893f4bc90d63 (diff) | |
download | libnice-a28b0e0be8c211c21c0a0158e4e7fb18750c1be1.tar.gz |
nicesrc: Don't leak a ref to the main context
Diffstat (limited to 'gst')
-rw-r--r-- | gst/gstnicesrc.c | 12 | ||||
-rw-r--r-- | gst/gstnicesrc.h | 1 |
2 files changed, 9 insertions, 4 deletions
diff --git a/gst/gstnicesrc.c b/gst/gstnicesrc.c index 37aabbf..ddae37e 100644 --- a/gst/gstnicesrc.c +++ b/gst/gstnicesrc.c @@ -180,7 +180,8 @@ gst_nice_src_init (GstNiceSrc *src, GstNiceSrcClass *g_class) src->agent = NULL; src->stream_id = 0; src->component_id = 0; - src->mainloop = g_main_loop_new (g_main_context_new (), FALSE); + src->mainctx = g_main_context_new (); + src->mainloop = g_main_loop_new (src->mainctx, FALSE); src->unlocked = FALSE; src->idle_source = NULL; } @@ -308,6 +309,10 @@ gst_nice_src_dispose (GObject *object) g_main_loop_unref (src->mainloop); src->mainloop = NULL; + if (src->mainctx) + g_main_context_unref (src->mainctx); + src->mainctx = NULL; + GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object)); } @@ -392,13 +397,12 @@ gst_nice_src_change_state (GstElement * element, GstStateChange transition) else { nice_agent_attach_recv (src->agent, src->stream_id, src->component_id, - g_main_loop_get_context (src->mainloop), - gst_nice_src_read_callback, (gpointer) src); + src->mainctx, gst_nice_src_read_callback, (gpointer) src); } break; case GST_STATE_CHANGE_READY_TO_NULL: nice_agent_attach_recv (src->agent, src->stream_id, src->component_id, - g_main_loop_get_context (src->mainloop), NULL, NULL); + src->mainctx, NULL, NULL); break; default: break; diff --git a/gst/gstnicesrc.h b/gst/gstnicesrc.h index 96e8f2a..595ff75 100644 --- a/gst/gstnicesrc.h +++ b/gst/gstnicesrc.h @@ -65,6 +65,7 @@ struct _GstNiceSrc NiceAgent *agent; guint stream_id; guint component_id; + GMainContext *mainctx; GMainLoop *mainloop; guint64 offset; GstFlowReturn flow_ret; |