This issue applies to 0.9.12.
Consider the connectKeyPressEvent method of gtk3/gtk/widget.d:7843 which provides the interface between C and D.
gulong connectKeyPressEvent(T)(T callback, Flag!"After" after = No.After)
When the signal is raised, GTK send a boxed event struct and a widget. The code unmarshalls the widget parameter correctly, but the event is not unmarshalled correctly. This is because GTK sends the event as a boxed struct, but the function expects it to be a pointer to an event object which is incorrect. The reason is because connectKeyPress function inspects the callback delegate and finds a class instead of a boxed struct.
This happens in gobject/value.d:1079: T getVal(T)(const(GValue)* gval)
else static if (is(T : Object) || isPointer!T) {
return cast(T)g_value_get_pointer(gval);
}
The error is also confirmed by GTK itself because it reports an error: assert(value == pointer)
I currently fixed it (for this event only) by doing the unboxing directly in widget.d instead of in value.d like so:
static if (Parameters!T.length > 0) {
// original line
// _paramTuple[0] = getVal!(Parameters!T[0])(&_paramVals[1]);
// corrected code.
alias V = Parameters!T[0];
_paramTuple[0] = new V(g_value_get_boxed(&_paramVals[1]),No.Take);
}
This issue applies to 0.9.12.
Consider the
connectKeyPressEventmethod ofgtk3/gtk/widget.d:7843which provides the interface between C and D.When the signal is raised, GTK send a boxed event struct and a widget. The code unmarshalls the widget parameter correctly, but the event is not unmarshalled correctly. This is because GTK sends the event as a boxed struct, but the function expects it to be a pointer to an event object which is incorrect. The reason is because connectKeyPress function inspects the callback delegate and finds a class instead of a boxed struct.
This happens in
gobject/value.d:1079: T getVal(T)(const(GValue)* gval)The error is also confirmed by GTK itself because it reports an error:
assert(value == pointer)I currently fixed it (for this event only) by doing the unboxing directly in widget.d instead of in value.d like so: