Bug 268463 - Qyoto delegate marshalling fails in Signals/Slots
Summary: Qyoto delegate marshalling fails in Signals/Slots
Status: RESOLVED WORKSFORME
Alias: None
Product: bindings
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: kde-bindings
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-14 14:41 UTC by Ilmar Kruis
Modified: 2023-01-18 05:12 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilmar Kruis 2011-03-14 14:41:17 UTC
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
Comment 1 Arno Rehn 2011-03-14 15:28:19 UTC
Can you attach a patch (produced with 'git diff' for example)? I'd apply this, if it looks good.
Comment 2 Andrew Crouthamel 2018-11-05 03:14:24 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Andrew Crouthamel 2018-11-17 05:06:08 UTC
Dear Bug Submitter,

This is a reminder that this bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? This bug will be moved back to REPORTED Status for manual review later, which may take a while. If you are able to, please lend us a hand.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Justin Zobel 2022-12-19 00:13:33 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 5 Bug Janitor Service 2023-01-03 05:27:35 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Bug Janitor Service 2023-01-18 05:12:32 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!