New plugin API

Gary Kramlich grim at reaperworld.com
Fri Aug 9 11:16:04 EDT 2013


On Fri, Aug 9, 2013 at 7:05 AM, Ankit Vani <a at nevitus.org> wrote:

> However, GPlugin refs everything before returning it to us. So basically
> you
> would need to do things like:
>
> GPluginPluginInfo *info = gplugin_plugin_get_info(plugin);
>
> if (!gplugin_plugin_info_get_name()) {
>     g_object_unref(info);
>     return FALSE;
> }
>
> g_object_unref(info);
> return TRUE;
>
> This is not really a problem but it is different from how other
> GObjectified
> entities in libpurple are used. And someone might at some point forget to
> unref
> a retrieved object, causing a leak.
>
> And as with other purple objects, we can ref and unref them only where
> necessary
> for the sake of uniformity and simplicity.
>
>
                                                                     - Ankit
>

GPlugin returns a new reference to an object in an attempt to be thread
safe.  You'll see the same behavior in Gtk and other GObject based
libraries.  The consumers of those libraries handle this appropriately and
don't play the "let's home this doesn't get deleted from underneath me
game".

Thank,

--
Gary Kramlich <grim at reaperworld.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pidgin.im/pipermail/devel/attachments/20130809/808862f6/attachment.html>


More information about the Devel mailing list