Re: GtkTextView->get_iter_at_location bug or user error?

On Wednesday, July 30, 2003, at 06:50  PM, Ross McFarland wrote:

but why isn't it like everything else in gtk
and return the iter rather than have a pass by reference and a return
type of void.

that's the funkiness of the C iterators in gtk. they are designed for speed because they are used *a* *lot*, and thus are meant to be allocated on the stack rather than on the heap. almost all the iterator functions for both the text and tree widgets are this way -- you pass a pointer to an iterator to be filled with the values for a specific context.

in perl, of course, this sort of usage is out of the question, so we nearly always return a new iter, except for things like the cursor movement functions which modify an iter. it's a very sloppy aspect of the bindings, imho.

get_iter_at_location must have just slipped through the cracks.

we can change the behavior of Gtk2-Perl and return a GtkTextIter from
the function as you thought would happen.

this is what should happen. i had a fix ready when i saw this message. ;-)

but this doesn't sit well
with me as i don't know the reason why they implemented it this way in
the first place. perhaps this is a function that gets called A LOT and
they don't want to have to do the malloc of a GtkTextIter every time, i
don't know.

ah, there, you already thought of it.  never mind.  :-)

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