Re: [anjuta-devel] Change project property interface



Hello Sébastien,

              في ن، 19-12-2011 عند 19:59 +0100 ، كتب Sébastien Granjoux:
The only question remaining is the memory management of the properties
and properties_info lists: how is one supposed to free them?

In the autotools backend, the lists are owned by the plugin itself, so 
the plugin should free them when it is deactivated.

I have added a flag ANJUTA_PROJECT_PROPERTY_STATIC to have temporary 
properties owned by the node.

I think you can consider the each nodes owns its own properties info 
list. My goal was to avoid enforcing one memory managment scheme. Is 
there an issue to do this?

Well, for GObject introspection to work, you need to enforce a memory
management scheme. Having a possibility to short-circuit that scheme for
C may be doable, even though I don't like this much.

The real problem now is that the lists properties and properties info
are created by AnjutaProjectNode and so should be freed there. Then what
should be done for the content of these lists? A possible solution is to
have the node own the properties but not the property info.

So the dispose (or finalize, I'm not sure) function of AnjutaProjectNode
should:
        g_list_foreach (self->properties, anjuta_project_property_free);
        g_list_free (self->properties);

        g_list_free (self->properties_info);

The C plugins could short-circuit this scheme by setting the lists to
NULL (after doing whatever is appropriate) before chaining up to the
parent destructor.

What do you think of this?

And for modifying a property, is removing the current one and inserting
another one a good idea? (I see that the am-backend is modifying the
property in place)

I have done it in place because it's easier. We can add a function to do 
it if you need.

I'm fine either way.

Some more thoughts:
     * Making these lists gobject properties wasn't really a good idea.

We can remove these properties. Most of the time, I don't use gobject 
properties. I think they are useful when you need constructors 
parameters or when you need a very flexible interface as it allowed you 
to configure your object from a string. If it's not needed for bindings, 
I think it's better to remove them.

name, file, and type are interesting to have (to ease construction),
properties and properties_info are more pain than they are worth and
should probably be removed. I'm not sure what to do with state however.

     * The property field in AnjutaProjectPropertyInfo should probably be
renamed to default_value or something like this.

I would like to name it default, but it's one of the few C reserved 
words. I don't like the current "property" name, so "default_value" is a 
bit long but fine for me.

Ok.

Regards,
Abderrahim




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]