[gst-cvs] gst-plugins-bad: camerabin: Fix leaks in the preview handling
Thiago Sousa Santos
thiagoss at kemper.freedesktop.org
Tue Nov 2 05:46:05 PDT 2010
Module: gst-plugins-bad
Branch: master
Commit: 7ae195788a6866466558ea9af26a4df830d1b96f
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=7ae195788a6866466558ea9af26a4df830d1b96f
Author: Thiago Santos <thiago.sousa.santos at collabora.co.uk>
Date: Tue Nov 2 09:39:49 2010 -0300
camerabin: Fix leaks in the preview handling
Remember to unref the bus after adding the watch.
Remember to unref the element after getting it with
gst_bin_get_by_name.
---
gst/camerabin/camerabinpreview.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/gst/camerabin/camerabinpreview.c b/gst/camerabin/camerabinpreview.c
index d1d2a81..0f11bde 100644
--- a/gst/camerabin/camerabinpreview.c
+++ b/gst/camerabin/camerabinpreview.c
@@ -229,6 +229,7 @@ gst_camerabin_preview_convert (GstCameraBin * camera,
bus = gst_element_get_bus (pipeline);
msg = gst_bus_timed_pop_filtered (bus, (25 * GST_SECOND),
GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
+ gst_bus_unref (bus);
if (msg) {
switch (GST_MESSAGE_TYPE (msg)) {
@@ -308,15 +309,17 @@ gst_camerabin_preview_send_event (GstCameraBin * camera, GstElement * pipeline,
GstEvent * evt)
{
GstElement *src;
+ gboolean ret = FALSE;
src = gst_bin_get_by_name (GST_BIN (pipeline), "prev_src");
if (!src) {
GST_WARNING ("Preview pipeline doesn't have src element, can't push event");
gst_event_unref (evt);
- return FALSE;
+ } else {
+ GST_DEBUG_OBJECT (camera, "Pushing event %p to preview pipeline", evt);
+ ret = gst_element_send_event (src, evt);
+ gst_object_unref (src);
}
- GST_DEBUG_OBJECT (camera, "Pushing event %p to preview pipeline", evt);
-
- return gst_element_send_event (src, evt);
+ return ret;
}
More information about the Gstreamer-commits
mailing list