Fixes a bunch of problems with finalize and dispose functions, either assumptions that dispose is only called once, o...

Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_class_init), (gst_alsa_dispose),
(gst_alsa_finalize):
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_class_init),
(gst_cdaudio_finalize):
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_finalize):
* ext/divx/gstdivxdec.c: (gst_divxdec_dispose):
* ext/divx/gstdivxenc.c: (gst_divxenc_dispose):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_finalize):
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
(gst_flacdec_finalize):
* ext/flac/gstflacenc.c: (gst_flacenc_class_init),
(gst_flacenc_finalize):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_class_init),
(gst_gnomevfssink_finalize):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_class_init),
(gst_gnomevfssrc_finalize):
* ext/libfame/gstlibfame.c: (gst_fameenc_class_init),
(gst_fameenc_finalize):
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_finalize):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_class_init):
* ext/sndfile/gstsf.c: (gst_sf_dispose):
* gst-libs/gst/mixer/mixertrack.c: (gst_mixer_track_dispose):
* gst-libs/gst/tuner/tunerchannel.c: (gst_tuner_channel_dispose):
* gst-libs/gst/tuner/tunernorm.c: (gst_tuner_norm_dispose):
* gst-libs/gst/xwindowlistener/xwindowlistener.c:
(gst_x_window_listener_dispose):
* gst/audioscale/gstaudioscale.c:
* gst/playondemand/gstplayondemand.c: (play_on_demand_class_init),
(play_on_demand_finalize):
* gst/videofilter/gstvideobalance.c: (gst_videobalance_dispose):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
* sys/cdrom/gstcdplayer.c: (cdplayer_class_init),
(cdplayer_finalize):
* sys/glsink/glimagesink.c: (gst_glimagesink_finalize),
(gst_glimagesink_class_init):
* sys/oss/gstosselement.c: (gst_osselement_class_init),
(gst_osselement_finalize):
* sys/oss/gstosssink.c: (gst_osssink_dispose):
* sys/oss/gstosssrc.c: (gst_osssrc_dispose):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_dispose):
Fixes a bunch of problems with finalize and dispose functions,
either assumptions that dispose is only called once, or not calling
the parent class dispose/finalize function
This commit is contained in:
Jan Schmidt 2004-11-01 14:43:38 +00:00
parent 3fcf384570
commit 4cf67a0834
15 changed files with 102 additions and 25 deletions

View file

@ -1,3 +1,52 @@
2004-11-02 Jan Schmidt <thaytan@mad.scientist.com>
* ext/alsa/gstalsa.c: (gst_alsa_class_init), (gst_alsa_dispose),
(gst_alsa_finalize):
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_class_init),
(gst_cdaudio_finalize):
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_finalize):
* ext/divx/gstdivxdec.c: (gst_divxdec_dispose):
* ext/divx/gstdivxenc.c: (gst_divxenc_dispose):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_finalize):
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
(gst_flacdec_finalize):
* ext/flac/gstflacenc.c: (gst_flacenc_class_init),
(gst_flacenc_finalize):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_class_init),
(gst_gnomevfssink_finalize):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_class_init),
(gst_gnomevfssrc_finalize):
* ext/libfame/gstlibfame.c: (gst_fameenc_class_init),
(gst_fameenc_finalize):
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_finalize):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_class_init):
* ext/sndfile/gstsf.c: (gst_sf_dispose):
* gst-libs/gst/mixer/mixertrack.c: (gst_mixer_track_dispose):
* gst-libs/gst/tuner/tunerchannel.c: (gst_tuner_channel_dispose):
* gst-libs/gst/tuner/tunernorm.c: (gst_tuner_norm_dispose):
* gst-libs/gst/xwindowlistener/xwindowlistener.c:
(gst_x_window_listener_dispose):
* gst/audioscale/gstaudioscale.c:
* gst/playondemand/gstplayondemand.c: (play_on_demand_class_init),
(play_on_demand_finalize):
* gst/videofilter/gstvideobalance.c: (gst_videobalance_dispose):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
* sys/cdrom/gstcdplayer.c: (cdplayer_class_init),
(cdplayer_finalize):
* sys/glsink/glimagesink.c: (gst_glimagesink_finalize),
(gst_glimagesink_class_init):
* sys/oss/gstosselement.c: (gst_osselement_class_init),
(gst_osselement_finalize):
* sys/oss/gstosssink.c: (gst_osssink_dispose):
* sys/oss/gstosssrc.c: (gst_osssrc_dispose):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_dispose):
Fixes a bunch of problems with finalize and dispose functions,
either assumptions that dispose is only called once, or not calling
the parent class dispose/finalize function
2004-11-01 Stefan Kost <ensonic@users.sf.net> 2004-11-01 Stefan Kost <ensonic@users.sf.net>
* ext/esd/esdsink.c: (gst_esdsink_init), (gst_esdsink_link): * ext/esd/esdsink.c: (gst_esdsink_init), (gst_esdsink_link):

View file

@ -51,6 +51,7 @@
static void gst_alsa_class_init (gpointer g_class, gpointer class_data); static void gst_alsa_class_init (gpointer g_class, gpointer class_data);
static void gst_alsa_init (GstAlsa * this); static void gst_alsa_init (GstAlsa * this);
static void gst_alsa_dispose (GObject * object); static void gst_alsa_dispose (GObject * object);
static void gst_alsa_finalize (GObject * object);
static void gst_alsa_set_property (GObject * object, static void gst_alsa_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec); guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_alsa_get_property (GObject * object, static void gst_alsa_get_property (GObject * object,
@ -161,6 +162,7 @@ gst_alsa_class_init (gpointer g_class, gpointer class_data)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT); parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
object_class->dispose = gst_alsa_dispose; object_class->dispose = gst_alsa_dispose;
object_class->finalize = gst_alsa_finalize;
object_class->get_property = gst_alsa_get_property; object_class->get_property = gst_alsa_get_property;
object_class->set_property = gst_alsa_set_property; object_class->set_property = gst_alsa_set_property;
@ -218,14 +220,23 @@ gst_alsa_dispose (GObject * object)
{ {
GstAlsa *this = GST_ALSA (object); GstAlsa *this = GST_ALSA (object);
g_free (this->device); if (this->clock) {
if (this->clock)
gst_object_unparent (GST_OBJECT (this->clock)); gst_object_unparent (GST_OBJECT (this->clock));
this->clock = NULL;
}
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->dispose (object);
} }
static void
gst_alsa_finalize (GObject * object)
{
GstAlsa *this = GST_ALSA (object);
g_free (this->device);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void static void
gst_alsa_set_property (GObject * object, guint prop_id, const GValue * value, gst_alsa_set_property (GObject * object, guint prop_id, const GValue * value,
GParamSpec * pspec) GParamSpec * pspec)

View file

@ -138,7 +138,7 @@ enum
static void cdparanoia_base_init (gpointer g_class); static void cdparanoia_base_init (gpointer g_class);
static void cdparanoia_class_init (CDParanoiaClass * klass); static void cdparanoia_class_init (CDParanoiaClass * klass);
static void cdparanoia_init (CDParanoia * cdparanoia); static void cdparanoia_init (CDParanoia * cdparanoia);
static void cdparanoia_dispose (GObject * obj); static void cdparanoia_finalize (GObject * obj);
static void cdparanoia_set_property (GObject * object, guint prop_id, static void cdparanoia_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
@ -279,7 +279,7 @@ cdparanoia_class_init (CDParanoiaClass * klass)
gobject_class->set_property = cdparanoia_set_property; gobject_class->set_property = cdparanoia_set_property;
gobject_class->get_property = cdparanoia_get_property; gobject_class->get_property = cdparanoia_get_property;
gobject_class->dispose = cdparanoia_dispose; gobject_class->finalize = cdparanoia_finalize;
gstelement_class->change_state = cdparanoia_change_state; gstelement_class->change_state = cdparanoia_change_state;
gstelement_class->set_index = cdparanoia_set_index; gstelement_class->set_index = cdparanoia_set_index;
@ -324,16 +324,14 @@ cdparanoia_init (CDParanoia * cdparanoia)
} }
static void static void
cdparanoia_dispose (GObject * obj) cdparanoia_finalize (GObject * obj)
{ {
CDParanoia *cdparanoia; CDParanoia *cdparanoia = CDPARANOIA (obj);
cdparanoia = CDPARANOIA (obj);
g_free (cdparanoia->uri); g_free (cdparanoia->uri);
cdparanoia->uri = NULL; cdparanoia->uri = NULL;
G_OBJECT_CLASS (parent_class)->dispose (obj); G_OBJECT_CLASS (parent_class)->finalize (obj);
} }
static void static void

View file

@ -102,7 +102,7 @@ enum
static void gst_gnomevfssink_base_init (gpointer g_class); static void gst_gnomevfssink_base_init (gpointer g_class);
static void gst_gnomevfssink_class_init (GstGnomeVFSSinkClass * klass); static void gst_gnomevfssink_class_init (GstGnomeVFSSinkClass * klass);
static void gst_gnomevfssink_init (GstGnomeVFSSink * gnomevfssink); static void gst_gnomevfssink_init (GstGnomeVFSSink * gnomevfssink);
static void gst_gnomevfssink_dispose (GObject * obj); static void gst_gnomevfssink_finalize (GObject * obj);
static void gst_gnomevfssink_uri_handler_init (gpointer g_iface, static void gst_gnomevfssink_uri_handler_init (gpointer g_iface,
gpointer iface_data); gpointer iface_data);
@ -212,7 +212,7 @@ gst_gnomevfssink_class_init (GstGnomeVFSSinkClass * klass)
gobject_class->set_property = gst_gnomevfssink_set_property; gobject_class->set_property = gst_gnomevfssink_set_property;
gobject_class->get_property = gst_gnomevfssink_get_property; gobject_class->get_property = gst_gnomevfssink_get_property;
gobject_class->dispose = gst_gnomevfssink_dispose; gobject_class->finalize = gst_gnomevfssink_finalize;
gstelement_class->change_state = gst_gnomevfssink_change_state; gstelement_class->change_state = gst_gnomevfssink_change_state;
@ -222,7 +222,7 @@ gst_gnomevfssink_class_init (GstGnomeVFSSinkClass * klass)
} }
static void static void
gst_gnomevfssink_dispose (GObject * obj) gst_gnomevfssink_finalize (GObject * obj)
{ {
GstGnomeVFSSink *sink = GST_GNOMEVFSSINK (obj); GstGnomeVFSSink *sink = GST_GNOMEVFSSINK (obj);
@ -235,6 +235,8 @@ gst_gnomevfssink_dispose (GObject * obj)
g_free (sink->uri_name); g_free (sink->uri_name);
sink->uri_name = NULL; sink->uri_name = NULL;
} }
G_OBJECT_CLASS (parent_class)->finalize (obj);
} }
static void static void

View file

@ -200,7 +200,7 @@ enum
static void gst_gnomevfssrc_base_init (gpointer g_class); static void gst_gnomevfssrc_base_init (gpointer g_class);
static void gst_gnomevfssrc_class_init (GstGnomeVFSSrcClass * klass); static void gst_gnomevfssrc_class_init (GstGnomeVFSSrcClass * klass);
static void gst_gnomevfssrc_init (GstGnomeVFSSrc * gnomevfssrc); static void gst_gnomevfssrc_init (GstGnomeVFSSrc * gnomevfssrc);
static void gst_gnomevfssrc_dispose (GObject * object); static void gst_gnomevfssrc_finalize (GObject * object);
static void gst_gnomevfssrc_uri_handler_init (gpointer g_iface, static void gst_gnomevfssrc_uri_handler_init (gpointer g_iface,
gpointer iface_data); gpointer iface_data);
@ -284,7 +284,7 @@ gst_gnomevfssrc_class_init (GstGnomeVFSSrcClass * klass)
"bytesperread", ARG_BYTESPERREAD, G_PARAM_READWRITE, "bytesperread", ARG_BYTESPERREAD, G_PARAM_READWRITE,
"location", ARG_LOCATION, G_PARAM_READWRITE, NULL); "location", ARG_LOCATION, G_PARAM_READWRITE, NULL);
gobject_class->dispose = gst_gnomevfssrc_dispose; gobject_class->finalize = gst_gnomevfssrc_finalize;
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
ARG_HANDLE, ARG_HANDLE,
@ -381,7 +381,7 @@ gst_gnomevfssrc_init (GstGnomeVFSSrc * gnomevfssrc)
} }
static void static void
gst_gnomevfssrc_dispose (GObject * object) gst_gnomevfssrc_finalize (GObject * object)
{ {
GstGnomeVFSSrc *src = GST_GNOMEVFSSRC (object); GstGnomeVFSSrc *src = GST_GNOMEVFSSRC (object);
@ -407,7 +407,7 @@ gst_gnomevfssrc_dispose (GObject * object)
g_mutex_free (src->audiocast_udpdata_mutex); g_mutex_free (src->audiocast_udpdata_mutex);
g_mutex_free (src->audiocast_queue_mutex); g_mutex_free (src->audiocast_queue_mutex);
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
static guint static guint

View file

@ -183,8 +183,10 @@ gst_mixer_track_dispose (GObject * object)
{ {
GstMixerTrack *channel = GST_MIXER_TRACK (object); GstMixerTrack *channel = GST_MIXER_TRACK (object);
if (channel->label) if (channel->label) {
g_free (channel->label); g_free (channel->label);
channel->label = NULL;
}
if (parent_class->dispose) if (parent_class->dispose)
parent_class->dispose (object); parent_class->dispose (object);

View file

@ -104,8 +104,10 @@ gst_tuner_channel_dispose (GObject * object)
{ {
GstTunerChannel *channel = GST_TUNER_CHANNEL (object); GstTunerChannel *channel = GST_TUNER_CHANNEL (object);
if (channel->label) if (channel->label) {
g_free (channel->label); g_free (channel->label);
channel->label = NULL;
}
if (parent_class->dispose) if (parent_class->dispose)
parent_class->dispose (object); parent_class->dispose (object);

View file

@ -88,8 +88,10 @@ gst_tuner_norm_dispose (GObject * object)
{ {
GstTunerNorm *norm = GST_TUNER_NORM (object); GstTunerNorm *norm = GST_TUNER_NORM (object);
if (norm->label) if (norm->label) {
g_free (norm->label); g_free (norm->label);
norm->label = NULL;
}
if (parent_class->dispose) if (parent_class->dispose)
parent_class->dispose (object); parent_class->dispose (object);

View file

@ -183,8 +183,10 @@ gst_mixer_track_dispose (GObject * object)
{ {
GstMixerTrack *channel = GST_MIXER_TRACK (object); GstMixerTrack *channel = GST_MIXER_TRACK (object);
if (channel->label) if (channel->label) {
g_free (channel->label); g_free (channel->label);
channel->label = NULL;
}
if (parent_class->dispose) if (parent_class->dispose)
parent_class->dispose (object); parent_class->dispose (object);

View file

@ -104,8 +104,10 @@ gst_tuner_channel_dispose (GObject * object)
{ {
GstTunerChannel *channel = GST_TUNER_CHANNEL (object); GstTunerChannel *channel = GST_TUNER_CHANNEL (object);
if (channel->label) if (channel->label) {
g_free (channel->label); g_free (channel->label);
channel->label = NULL;
}
if (parent_class->dispose) if (parent_class->dispose)
parent_class->dispose (object); parent_class->dispose (object);

View file

@ -88,8 +88,10 @@ gst_tuner_norm_dispose (GObject * object)
{ {
GstTunerNorm *norm = GST_TUNER_NORM (object); GstTunerNorm *norm = GST_TUNER_NORM (object);
if (norm->label) if (norm->label) {
g_free (norm->label); g_free (norm->label);
norm->label = NULL;
}
if (parent_class->dispose) if (parent_class->dispose)
parent_class->dispose (object); parent_class->dispose (object);

View file

@ -96,6 +96,7 @@ gst_x_window_listener_dispose (GObject * object)
if (xwin->display_name) { if (xwin->display_name) {
g_free (xwin->display_name); g_free (xwin->display_name);
xwin->display_name = NULL;
} }
if (parent_class->dispose) { if (parent_class->dispose) {

View file

@ -588,9 +588,12 @@ static void gst_audioscale_dispose (GObject * object)
if (audioscale->gst_resample) { if (audioscale->gst_resample) {
g_free (audioscale->gst_resample); g_free (audioscale->gst_resample);
audioscale->gst_resample = NULL;
} }
if (audioscale->offsets) if (audioscale->offsets) {
g_free (audioscale->offsets); g_free (audioscale->offsets);
audioscale->offsets = NULL;
}
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->dispose (object);
} }

View file

@ -551,7 +551,7 @@ gst_videoscale_chain (GstPad * pad, GstData * _data)
outbuf = gst_pad_alloc_buffer (videoscale->srcpad, outbuf = gst_pad_alloc_buffer (videoscale->srcpad,
GST_BUFFER_OFFSET_NONE, videoscale->to_buf_size); GST_BUFFER_OFFSET_NONE, videoscale->to_buf_size);
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf); gst_buffer_stamp (outbuf, buf);
g_return_if_fail (videoscale->format); g_return_if_fail (videoscale->format);
GST_LOG_OBJECT (videoscale, "format " GST_FOURCC_FORMAT, GST_LOG_OBJECT (videoscale, "format " GST_FOURCC_FORMAT,

View file

@ -412,6 +412,7 @@ gst_v4lelement_dispose (GObject * object)
if (v4lelement->videodev) { if (v4lelement->videodev) {
g_free (v4lelement->videodev); g_free (v4lelement->videodev);
v4lelement->videodev = NULL;
} }
if (((GObjectClass *) parent_class)->dispose) if (((GObjectClass *) parent_class)->dispose)