[Kde-bindings] [Bug 268463] New: Qyoto delegate marshalling fails in Signals/Slots
Ilmar Kruis
ikruis at gmail.com
Mon Mar 14 13:41:19 UTC 2011
https://bugs.kde.org/show_bug.cgi?id=268463
Summary: Qyoto delegate marshalling fails in Signals/Slots
Product: bindings
Version: unspecified
Platform: Compiled Sources
OS/Version: MS Windows
Status: UNCONFIRMED
Severity: normal
Priority: NOR
Component: general
AssignedTo: kde-bindings at kde.org
ReportedBy: ikruis at gmail.com
Version: unspecified (using Devel)
OS: MS Windows
Binding delegates to Qyoto slots often failed for me. Recently recompiled for
.NET 4 and the Managed Debugging Assistant pointed me to the following
problems:
- The Extern functions in QObjectExtras.cs don't have a CallingConvention
specified, defaults to the wrong __stdcall on Windows.
- In C# code, the delegate is 'set' with ConnectDelegate, then stored as
Function pointer in C. When it is invoked, InvokeDelegate will create a new
delegate from that function pointer. .NET requires a fully defined delegate
type instead of the general Delegate for this.
The first issue is easily solved, the second I solved for me by changing
delegateinvocation.h to pass the GCHandle instead of the function pointer:
int qt_metacall(QMetaObject::Call call, int id, void **a)
{
id = QObject::qt_metacall(call, id, a);
if (id < 0)
return id;
if (call == QMetaObject::InvokeMetaMethod) {
if (id == 0) {
smokeStackFromQtStack(_stack, a + 1, 0, _items, _mocargs);
next();
(*InvokeDelegate)(_handle, _sp);
}
--id;
}
return id;
}
And SmokeInvocation.cs to accept it and find the delegate linked to it:
static public void InvokeDelegate(IntPtr _d, IntPtr stack) {
Delegate d = (Delegate)GCHandle.FromIntPtr(_d).Target;
unsafe {
Reproducible: Sometimes
--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Kde-bindings
mailing list