Re: boxed types and copies



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.

hm, i'm kinda two folded on that issue.

on the one hand, the easy thing to do is to restore gtk_signal_emit(),
but then, your signals that use these boxed types are really only
usable with gtk_signal_emit() (not g_signal_emit()).
beyond that, code that deals with your boxed values will get things wrong,
since you copy the structure while you actually want it passed by
reference.
i think owen has a similar thing with selection data or something...
basically, boxed values that aren't usefully copyable, must be reference
counted so they can be passed by reference.
the reference counting doesn't need to be exposed, you can have static
ref/unref and pass that in to g_boxed_type_register_static().

owen, what do you say? boxed types need to be either copy-able or
reference counted, otherwise LBs or editors can't pass them around
and store them away anyways. doing that static hack for gtk_signal_emit()
just defers the problem and makes things work for just this moment in our
limited testgtk universe.

> 
> Havoc
> 

---
ciaoTJ





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