summaryrefslogtreecommitdiffstats
path: root/ext/gconf
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@mad.scientist.com>2007-03-04 13:52:03 +0000
committerJan Schmidt <thaytan@mad.scientist.com>2007-03-04 13:52:03 +0000
commitde1357a4074d7cab9df163237bcfbce653d417e7 (patch)
treefe0a5f3335039c705d0d7c1b2f1c2367eac4231e /ext/gconf
parent382d7f0ba54a4752275446e613b1b295203e9dbf (diff)
Fix a bunch of leaks shown by the newly-added states test.
Original commit message from CVS: * ext/flac/gstflacenc.c: (gst_flac_enc_finalize): * ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_class_init), (gst_gconf_audio_sink_dispose), (gst_gconf_audio_sink_finalize): * ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init), (gst_gconf_audio_src_class_init), (gst_gconf_audio_src_dispose), (gst_gconf_audio_src_finalize), (do_toggle_element): * ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init), (gst_gconf_video_sink_class_init), (gst_gconf_video_sink_finalize), (do_toggle_element): * ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init), (gst_gconf_video_src_class_init), (gst_gconf_video_src_dispose), (gst_gconf_video_src_finalize), (do_toggle_element): * ext/gconf/gstswitchsink.c: (gst_switch_sink_class_init), (gst_switch_sink_reset), (gst_switch_sink_set_child): * ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init): * ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init): * ext/shout2/gstshout2.c: (gst_shout2send_class_init), (gst_shout2send_init), (gst_shout2send_finalize): * gst/debug/testplugin.c: (gst_test_class_init), (gst_test_finalize): * gst/flx/gstflxdec.c: (gst_flxdec_class_init), (gst_flxdec_dispose): * gst/multipart/multipartmux.c: (gst_multipart_mux_finalize): * gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_finalize): * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init), (gst_rtspsrc_finalize): * gst/rtsp/rtspextwms.c: (rtsp_ext_wms_free_context): * gst/rtsp/rtspextwms.h: * gst/smpte/gstsmpte.c: (gst_smpte_class_init), (gst_smpte_finalize): * gst/udp/gstmultiudpsink.c: (gst_multiudpsink_finalize): * gst/udp/gstudpsink.c: (gst_udpsink_class_init), (gst_udpsink_finalize): * gst/wavparse/gstwavparse.c: (gst_wavparse_dispose), (gst_wavparse_sink_activate): * sys/oss/gstosssink.c: (gst_oss_sink_finalise): * sys/oss/gstosssrc.c: (gst_oss_src_class_init), (gst_oss_src_finalize): * sys/v4l2/gstv4l2object.c: (gst_v4l2_object_destroy): * sys/v4l2/gstv4l2object.h: * sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init), (gst_v4l2src_finalize): * sys/ximage/gstximagesrc.c: (gst_ximage_src_ximage_get): Fix a bunch of leaks shown by the newly-added states test.
Diffstat (limited to 'ext/gconf')
-rw-r--r--ext/gconf/gstgconfaudiosink.c11
-rw-r--r--ext/gconf/gstgconfaudiosrc.c14
-rw-r--r--ext/gconf/gstgconfvideosink.c13
-rw-r--r--ext/gconf/gstgconfvideosrc.c25
-rw-r--r--ext/gconf/gstswitchsink.c5
5 files changed, 57 insertions, 11 deletions
diff --git a/ext/gconf/gstgconfaudiosink.c b/ext/gconf/gstgconfaudiosink.c
index 3ac1b897..0737af67 100644
--- a/ext/gconf/gstgconfaudiosink.c
+++ b/ext/gconf/gstgconfaudiosink.c
@@ -28,6 +28,7 @@
#include "gstgconfaudiosink.h"
static void gst_gconf_audio_sink_dispose (GObject * object);
+static void gst_gconf_audio_sink_finalize (GstGConfAudioSink * sink);
static void cb_change_child (GConfClient * client,
guint connection_id, GConfEntry * entry, gpointer data);
static GstStateChangeReturn
@@ -91,6 +92,7 @@ gst_gconf_audio_sink_class_init (GstGConfAudioSinkClass * klass)
oklass->set_property = gst_gconf_audio_sink_set_property;
oklass->get_property = gst_gconf_audio_sink_get_property;
oklass->dispose = gst_gconf_audio_sink_dispose;
+ oklass->finalize = (GObjectFinalizeFunc) gst_gconf_audio_sink_finalize;
eklass->change_state = gst_gconf_audio_sink_change_state;
g_object_class_install_property (oklass, PROP_PROFILE,
@@ -131,10 +133,15 @@ gst_gconf_audio_sink_dispose (GObject * object)
sink->client = NULL;
}
+ GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+}
+
+static void
+gst_gconf_audio_sink_finalize (GstGConfAudioSink * sink)
+{
g_free (sink->gconf_str);
- sink->gconf_str = NULL;
- GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+ GST_CALL_PARENT (G_OBJECT_CLASS, finalize, ((GObject *) (sink)));
}
static gboolean
diff --git a/ext/gconf/gstgconfaudiosrc.c b/ext/gconf/gstgconfaudiosrc.c
index 0203c2e2..b9379c4c 100644
--- a/ext/gconf/gstgconfaudiosrc.c
+++ b/ext/gconf/gstgconfaudiosrc.c
@@ -28,6 +28,7 @@
#include "gstgconfaudiosrc.h"
static void gst_gconf_audio_src_dispose (GObject * object);
+static void gst_gconf_audio_src_finalize (GstGConfAudioSrc * src);
static void cb_toggle_element (GConfClient * client,
guint connection_id, GConfEntry * entry, gpointer data);
static GstStateChangeReturn
@@ -45,7 +46,7 @@ gst_gconf_audio_src_base_init (gpointer klass)
"Source/Audio",
"Audio source embedding the GConf-settings for audio input",
"Ronald Bultje <rbultje@ronald.bitfreak.net>");
- GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
+ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
@@ -62,6 +63,7 @@ gst_gconf_audio_src_class_init (GstGConfAudioSrcClass * klass)
GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
oklass->dispose = gst_gconf_audio_src_dispose;
+ oklass->finalize = (GObjectFinalizeFunc) gst_gconf_audio_src_finalize;
eklass->change_state = gst_gconf_audio_src_change_state;
}
@@ -122,10 +124,15 @@ gst_gconf_audio_src_dispose (GObject * object)
src->client = NULL;
}
+ GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+}
+
+static void
+gst_gconf_audio_src_finalize (GstGConfAudioSrc * src)
+{
g_free (src->gconf_str);
- src->gconf_str = NULL;
- GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+ GST_CALL_PARENT (G_OBJECT_CLASS, finalize, ((GObject *) (src)));
}
static gboolean
@@ -151,6 +158,7 @@ do_toggle_element (GstGConfAudioSrc * src)
if (cur >= GST_STATE_READY || next == GST_STATE_PAUSED) {
GST_DEBUG_OBJECT (src, "already running, ignoring GConf change");
+ g_free (new_gconf_str);
return TRUE;
}
diff --git a/ext/gconf/gstgconfvideosink.c b/ext/gconf/gstgconfvideosink.c
index ed37287d..e22791db 100644
--- a/ext/gconf/gstgconfvideosink.c
+++ b/ext/gconf/gstgconfvideosink.c
@@ -27,6 +27,7 @@
#include "gstgconfvideosink.h"
static void gst_gconf_video_sink_dispose (GObject * object);
+static void gst_gconf_video_sink_finalize (GstGConfVideoSink * sink);
static void cb_toggle_element (GConfClient * client,
guint connection_id, GConfEntry * entry, gpointer data);
static GstStateChangeReturn
@@ -44,7 +45,7 @@ gst_gconf_video_sink_base_init (gpointer klass)
"Sink/Video",
"Video sink embedding the GConf-settings for video output",
"Ronald Bultje <rbultje@ronald.bitfreak.net>");
- GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
@@ -61,6 +62,7 @@ gst_gconf_video_sink_class_init (GstGConfVideoSinkClass * klass)
GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
oklass->dispose = gst_gconf_video_sink_dispose;
+ oklass->finalize = (GObjectFinalizeFunc) gst_gconf_video_sink_finalize;
eklass->change_state = gst_gconf_video_sink_change_state;
}
@@ -121,6 +123,14 @@ gst_gconf_video_sink_dispose (GObject * object)
GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
}
+static void
+gst_gconf_video_sink_finalize (GstGConfVideoSink * sink)
+{
+ g_free (sink->gconf_str);
+
+ GST_CALL_PARENT (G_OBJECT_CLASS, finalize, ((GObject *) (sink)));
+}
+
static gboolean
do_toggle_element (GstGConfVideoSink * sink)
{
@@ -148,6 +158,7 @@ do_toggle_element (GstGConfVideoSink * sink)
if (cur > GST_STATE_READY || next == GST_STATE_PAUSED) {
GST_DEBUG_OBJECT (sink,
"Auto-sink is already running. Ignoring GConf change");
+ g_free (new_gconf_str);
return TRUE;
}
diff --git a/ext/gconf/gstgconfvideosrc.c b/ext/gconf/gstgconfvideosrc.c
index 093545e3..2735a901 100644
--- a/ext/gconf/gstgconfvideosrc.c
+++ b/ext/gconf/gstgconfvideosrc.c
@@ -28,6 +28,7 @@
#include "gstgconfvideosrc.h"
static void gst_gconf_video_src_dispose (GObject * object);
+static void gst_gconf_video_src_finalize (GstGConfVideoSrc * src);
static void cb_toggle_element (GConfClient * client,
guint connection_id, GConfEntry * entry, gpointer data);
static GstStateChangeReturn
@@ -45,7 +46,7 @@ gst_gconf_video_src_base_init (gpointer klass)
"Source/Video",
"Video source embedding the GConf-settings for video input",
"Ronald Bultje <rbultje@ronald.bitfreak.net>");
- GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
+ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
@@ -62,6 +63,7 @@ gst_gconf_video_src_class_init (GstGConfVideoSrcClass * klass)
GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
oklass->dispose = gst_gconf_video_src_dispose;
+ oklass->finalize = (GObjectFinalizeFunc) gst_gconf_video_src_finalize;
eklass->change_state = gst_gconf_video_src_change_state;
}
@@ -117,10 +119,15 @@ gst_gconf_video_src_dispose (GObject * object)
src->client = NULL;
}
+ GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+}
+
+static void
+gst_gconf_video_src_finalize (GstGConfVideoSrc * src)
+{
g_free (src->gconf_str);
- src->gconf_str = NULL;
- GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+ GST_CALL_PARENT (G_OBJECT_CLASS, finalize, ((GObject *) (src)));
}
static gboolean
@@ -128,6 +135,7 @@ do_toggle_element (GstGConfVideoSrc * src)
{
GstPad *targetpad;
gchar *new_gconf_str;
+ GstState cur, next;
new_gconf_str = gst_gconf_get_string (GST_GCONF_AUDIOSRC_KEY);
if (new_gconf_str != NULL && src->gconf_str != NULL &&
@@ -138,6 +146,17 @@ do_toggle_element (GstGConfVideoSrc * src)
return TRUE;
}
+ GST_OBJECT_LOCK (src);
+ cur = GST_STATE (src);
+ next = GST_STATE_PENDING (src);
+ GST_OBJECT_UNLOCK (src);
+
+ if (cur >= GST_STATE_READY || next == GST_STATE_PAUSED) {
+ GST_DEBUG_OBJECT (src, "already running, ignoring GConf change");
+ g_free (new_gconf_str);
+ return TRUE;
+ }
+
g_free (src->gconf_str);
src->gconf_str = new_gconf_str;
diff --git a/ext/gconf/gstswitchsink.c b/ext/gconf/gstswitchsink.c
index d00336e9..9c091708 100644
--- a/ext/gconf/gstswitchsink.c
+++ b/ext/gconf/gstswitchsink.c
@@ -57,7 +57,7 @@ gst_switch_sink_class_init (GstSwitchSinkClass * klass)
{
GObjectClass *oklass = G_OBJECT_CLASS (klass);
GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
- GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
@@ -79,7 +79,7 @@ gst_switch_sink_class_init (GstSwitchSinkClass * klass)
static void
gst_switch_sink_reset (GstSwitchSink * sink)
{
- /* fakesink */
+ /* this will install fakesink if no other child has been set */
if (sink->kid == NULL) {
gst_switch_sink_set_child (sink, NULL);
}
@@ -189,6 +189,7 @@ gst_switch_sink_set_child (GstSwitchSink * sink, GstElement * new_kid)
if (cur == GST_STATE_PAUSED && next == GST_STATE_READY) {
return gst_switch_commit_new_kid (sink);
}
+
/* Sometime, it would be lovely to allow sink changes even when
* already running, but this involves sending an appropriate new-segment
* and possibly prerolling etc */