Re: boxed types and copies

James Henstridge <james daa com au> writes:

> On 12 Dec 2000, Havoc Pennington wrote:
> > 
> > Hi,
> > 
> > The recent gtk_signal_emit() change broke the text widget - I'm using
> > GTK_TYPE_TEXT_ITER, GTK_TYPE_STRING, etc. for the signal signature, 
> > at James' request, so Python can emit these signals.
> > 
> > However these signal args MUST be passed by reference, it is far too
> > slow to copy the inserted string, and the iterator is supposed to be
> > modified by the signal handlers.
> > 
> > Moving gtk_signal_emit() to the GValue collector causes it to
> > copy-by-value every boxed argument. So I either have to move back to
> > GTK_TYPE_POINTER and break language bindings, or leave GtkTextBuffer
> > broken.
> Moving back to simply using G_TYPE_POINTER would be very bad for
> language bindings (and the change for the GtkCTreeNode signal arguments to
> G_TYPE_POINTER has made the ctree almost unusable to language bindings).
> One possible solution is to allow `derived' G_TYPE_POINTER values.  By
> this, I mean they would have the same semantics as G_TYPE_POINTER, but
> have a different type code, so that language bindings could have a
> chance of handling them correctly.

While this would work, I believe this is completely wrong for something
like GtkRequisition or GtkTextIter - these are things that _can_ be
meaningfully copied by value.

Its just that doing so while emitting signals is:

 a) Inefficient
 b) Wrong when parameter is an out or in-out parameter.


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