[g-a-devel]Re: atk table interface problem



Hi Bolian:

I don't think this is a problem in your case: note that the memory
provided only holds ints.  Since ATK relies on glib, it makes sense to
use g_alloc/g_new to create the int array regardless of the
implementation toolkit, thus the client can use g_free safely in all
cases.

In other words the ATK implementation in Mozilla should use glib to
allocate the int array which is returned from get_selected_columns.

This applies to all the methods which return newly-allocated
structures/memory (but of course not those which return actual
AtkObjects, in the latter case the Atk objects should be freed with
g_object_unref()).

-Bill

On Wed, 2002-06-26 at 09:06, Bolian Yin wrote:
> Hi Bill,
> 
> I have a question about | get_selected_columns | in atktable interface, 
> which has prototype:
> -----------------------------------------------------------------------------------------
> gint              (* get_selected_columns)     (AtkTable      *table,
>                                                   gint          **selected);
> ------------------------------------------------------------------------------------------
> 
> In at-spi,  the function is used like this:
> 
> ---------------------------------
>   gint *selectedColumns;
>   ....
>   length = atk_table_get_selected_columns (table, &selectedColumns);
>   g_free ((gpointer) selectedColumns);
> -----------------------------------
> 
> So I know, the implementation side of |get_selected_columns|, is 
> reposible to malloc the memory, and user side free it.
> My question is,  the implementation provider may not use matching mem 
> new/delete methods with glib (e.g. in Mozilla will not use).  In this 
> case, g_free may cause problem.
> 
> What about your point about this?
> 
> Thanks,
> Bolian Yin
> 
> 





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