Re: Writable array returned from gtk_tree_path_get_indices()



On 2010-10-07 16:29, Tadej Borovšak wrote:
> You should definitely not modify values in returned array, since this
> central part of GtkTreePath. Currently, modifying parts of this array
> is the same as moving your path using gtk_tree_path_(next|prev)(), but
> if internal structure of GtkTreePath changes, you'll be in trouble.

That's true, unless GtkTreePath is essentially a gint array, and exposed
as such. This concept would be part of the ABI, and the internal
structure could never be changed.

I guess that was the essence of my question. Is that the case?

> I think that minimal thing to do here is to update docs to something
> like this: "Returns the current indices of path. This is an array of
> integers, each representing a node in a tree. This value should not be
> freed and members of array should not be modified." 

The best way of documenting 'don't modify' is to const the return value.
I've done both in my patch.

Filling a bug is
> definitely the way to go IMHO.

Here it is: https://bugzilla.gnome.org/show_bug.cgi?id=631659

Cheers,

Stef


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