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 cda239c8b4
commit 9888ea2990
7 changed files with 87 additions and 21 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

@ -56,7 +56,7 @@ enum
static void gst_flacdec_base_init (gpointer g_class); static void gst_flacdec_base_init (gpointer g_class);
static void gst_flacdec_class_init (FlacDecClass * klass); static void gst_flacdec_class_init (FlacDecClass * klass);
static void gst_flacdec_init (FlacDec * flacdec); static void gst_flacdec_init (FlacDec * flacdec);
static void gst_flacdec_dispose (GObject * object); static void gst_flacdec_finalize (GObject * object);
static void gst_flacdec_loop (GstElement * element); static void gst_flacdec_loop (GstElement * element);
static GstElementStateReturn gst_flacdec_change_state (GstElement * element); static GstElementStateReturn gst_flacdec_change_state (GstElement * element);
@ -169,7 +169,7 @@ gst_flacdec_class_init (FlacDecClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT); parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->dispose = gst_flacdec_dispose; gobject_class->finalize = gst_flacdec_finalize;
gstelement_class->change_state = gst_flacdec_change_state; gstelement_class->change_state = gst_flacdec_change_state;
} }
@ -231,7 +231,7 @@ gst_flacdec_init (FlacDec * flacdec)
} }
static void static void
gst_flacdec_dispose (GObject * object) gst_flacdec_finalize (GObject * object)
{ {
FlacDec *flacdec; FlacDec *flacdec;
@ -241,7 +241,7 @@ gst_flacdec_dispose (GObject * object)
FLAC__seekable_stream_decoder_delete (flacdec->decoder); FLAC__seekable_stream_decoder_delete (flacdec->decoder);
flacdec->decoder = NULL; flacdec->decoder = NULL;
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }

View file

@ -67,7 +67,7 @@ enum
static void gst_flacenc_base_init (gpointer g_class); static void gst_flacenc_base_init (gpointer g_class);
static void gst_flacenc_init (FlacEnc * flacenc); static void gst_flacenc_init (FlacEnc * flacenc);
static void gst_flacenc_class_init (FlacEncClass * klass); static void gst_flacenc_class_init (FlacEncClass * klass);
static void gst_flacenc_dispose (GObject * object); static void gst_flacenc_finalize (GObject * object);
static GstPadLinkReturn static GstPadLinkReturn
gst_flacenc_sinkconnect (GstPad * pad, const GstCaps * caps); gst_flacenc_sinkconnect (GstPad * pad, const GstCaps * caps);
@ -233,7 +233,7 @@ gst_flacenc_class_init (FlacEncClass * klass)
/* we have no properties atm so this is a bit silly */ /* we have no properties atm so this is a bit silly */
gobject_class->set_property = gst_flacenc_set_property; gobject_class->set_property = gst_flacenc_set_property;
gobject_class->get_property = gst_flacenc_get_property; gobject_class->get_property = gst_flacenc_get_property;
gobject_class->dispose = gst_flacenc_dispose; gobject_class->finalize = gst_flacenc_finalize;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
g_param_spec_enum ("quality", g_param_spec_enum ("quality",
@ -337,13 +337,13 @@ gst_flacenc_init (FlacEnc * flacenc)
} }
static void static void
gst_flacenc_dispose (GObject * object) gst_flacenc_finalize (GObject * object)
{ {
FlacEnc *flacenc = GST_FLACENC (object); FlacEnc *flacenc = GST_FLACENC (object);
FLAC__seekable_stream_encoder_delete (flacenc->encoder); FLAC__seekable_stream_encoder_delete (flacenc->encoder);
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
static GstPadLinkReturn static GstPadLinkReturn

View file

@ -153,20 +153,31 @@ gst_videobalance_dispose (GObject * object)
balance = GST_VIDEOBALANCE (object); balance = GST_VIDEOBALANCE (object);
for (i = 0; i < 256; i++) { if (balance->tableu) {
for (i = 0; i < 256; i++)
g_free (balance->tableu[i]); g_free (balance->tableu[i]);
g_free (balance->tablev[i]);
}
g_free (balance->tabley);
g_free (balance->tableu); g_free (balance->tableu);
balance->tableu = NULL;
}
if (balance->tablev) {
for (i = 0; i < 256; i++)
g_free (balance->tablev[i]);
g_free (balance->tablev); g_free (balance->tablev);
balance->tablev = NULL;
}
if (balance->tabley) {
g_free (balance->tabley);
balance->tabley = NULL;
}
channels = balance->channels; channels = balance->channels;
while (channels) { while (channels) {
GstColorBalanceChannel *channel = channels->data; GstColorBalanceChannel *channel = channels->data;
g_object_unref (channel); g_object_unref (channel);
channels->data = NULL;
channels = g_list_next (channels); channels = g_list_next (channels);
} }

View file

@ -72,7 +72,7 @@ static void gst_osselement_class_init (GstOssElementClass * klass);
static void gst_ossprobe_interface_init (GstPropertyProbeInterface * iface); static void gst_ossprobe_interface_init (GstPropertyProbeInterface * iface);
static void gst_osselement_init (GstOssElement * oss); static void gst_osselement_init (GstOssElement * oss);
static void gst_osselement_dispose (GObject * object); static void gst_osselement_finalize (GObject * object);
static void gst_osselement_set_property (GObject * object, static void gst_osselement_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec); guint prop_id, const GValue * value, GParamSpec * pspec);
@ -164,7 +164,7 @@ gst_osselement_class_init (GstOssElementClass * klass)
gobject_class->set_property = gst_osselement_set_property; gobject_class->set_property = gst_osselement_set_property;
gobject_class->get_property = gst_osselement_get_property; gobject_class->get_property = gst_osselement_get_property;
gobject_class->dispose = gst_osselement_dispose; gobject_class->finalize = gst_osselement_finalize;
gstelement_class->change_state = gst_osselement_change_state; gstelement_class->change_state = gst_osselement_change_state;
} }
@ -434,14 +434,14 @@ gst_osselement_init (GstOssElement * oss)
} }
static void static void
gst_osselement_dispose (GObject * object) gst_osselement_finalize (GObject * object)
{ {
GstOssElement *oss = (GstOssElement *) object; GstOssElement *oss = (GstOssElement *) object;
g_free (oss->device); g_free (oss->device);
g_free (oss->mixer_dev); g_free (oss->mixer_dev);
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
void void

View file

@ -152,7 +152,10 @@ gst_osssink_dispose (GObject * object)
{ {
GstOssSink *osssink = (GstOssSink *) object; GstOssSink *osssink = (GstOssSink *) object;
if (osssink->provided_clock) {
gst_object_unparent (GST_OBJECT (osssink->provided_clock)); gst_object_unparent (GST_OBJECT (osssink->provided_clock));
osssink->provided_clock = NULL;
}
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->dispose (object);
} }

View file

@ -222,7 +222,10 @@ gst_osssrc_dispose (GObject * object)
{ {
GstOssSrc *osssrc = (GstOssSrc *) object; GstOssSrc *osssrc = (GstOssSrc *) object;
if (osssrc->provided_clock != NULL) {
gst_object_unparent (GST_OBJECT (osssrc->provided_clock)); gst_object_unparent (GST_OBJECT (osssrc->provided_clock));
osssrc->provided_clock = NULL;
}
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->dispose (object);
} }