[gst-devel] finalize in a plugin

Eric Zhang nicolas.m.zhang at gmail.com
Fri Nov 28 11:14:22 CET 2008


Hi, gstreamer-devel:

    1. The `finalize' function will only be called once. The `dispose'
function can be called many times.

    2. Usually we use `g_object_unref' or `gst_object_unref'(in gstreamer)
to release the object. If the ref_count of this object reaches zero, the
`dispose' and `finalize' function will be called(dispose will be called
first and you can still ref the object in this function -- in that way, the
finalize function will not be called, that's why you can `dispose' many
times but only `finalize' once). Refer to the source code of
`g_object_unref' for more details.

    3. If you have pointers in your element, and I suppose you wanna free
the objects which these pointers point to, right? If so, you should call
`g_object_unref' to these pointers in your element's finalize function.

Eric Zhang

2008/11/28 Zoltan Seress <gatesofdarkness at gmail.com>

>
> Hi Dev,
>
> I know that this is not really a gstreamer specific question, rather
> GObject, so I read some GObject descriptions about finalize, but I would
> like to ask it nevertheless.
> How many times is the finalize function called during the life of a plugin?
> It is called only once at the destruction of the Class as the pair of the
> class_init? Is it a problem if I have some pointers as members of my
> element, but I don't overwrite the finalize function? Or is it called at the
> destruction of an element too?
> Thanks!
>
> Zoltan Seress
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20081128/419a9731/attachment.htm>


More information about the gstreamer-devel mailing list