[gst-devel] Destructor of an element

Stefan Kost ensonic at hora-obscura.de
Thu Oct 29 19:39:56 CET 2009


Tiago Katcipis schrieb:
> Looking at the GstAppSink code i found that i actually have to override
> the finalize function on the GObject class. Sorry to bother, I'm not
> very used with Gobject :-).
> 
> The GstAppSink code (on the class init function):
> 
> GObjectClass *gobject_class = (GObjectClass *) klass;
>   GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass;
> 
>   gobject_class->dispose = gst_app_sink_dispose;
>   gobject_class->finalize = gst_app_sink_finalize;
> 

just for your info, dispose can theortically be called multiple times and
finalize is called just once. The idea is to call unref in dispose, set object s
to NULL and check that incase its called again. Do free()s in finalize

Stefan

> 
> 
> On Thu, Oct 29, 2009 at 11:59 AM, Tiago Katcipis <katcipis at inf.ufsc.br
> <mailto:katcipis at inf.ufsc.br>> wrote:
> 
>     I'm building an element that uses an external lib, and when my
>     element is freed (it ref count reaches zero), i want to free some
>     stuff of the external lib i use. I didn't find anything about a
>     generic destructor function that i can override, so when my element
>     is being freed i can free the resources that i was using on my
>     plugin. Can anyone help me?
> 
>     best regards,
>     Katcipis
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel





More information about the gstreamer-devel mailing list