[Kde-bindings] [Qyoto] crash when using QList returned by QMimeData.Urls

Dimitar Dobrev dpldobrev at yahoo.com
Wed Feb 20 21:32:53 UTC 2013



    Thank you. However, there is one last detail - could you make sure it works with the GetInstance call. I mean like this:
    

                void *p = (void *) &(valuelist->at(i));
                void * obj = (*GetInstance)(p, true);

                if (obj == 0) {
                    p = (void *) new Item(*(Item*) p);

                    smokeqyoto_object * o = alloc_smokeqyoto_object(false, ix.smoke, ix.index, p);
                    obj = (*CreateInstance)(qyoto_resolve_classname(o), o);
                }   


    The thing is that GetInstance retrieves a pointer from a mapping between managed objects and their unmanaged counterparts. This mapping guarantees that if you called, say, QTableView.SelectionModel twice, you'd get the same managed object. So you can see that calls to GetInstance cannot be simply ignored.

    Regards,
    Dimitar   


________________________________
 From: David Lechner <david at lechnology.com>
To: kde-bindings at kde.org 
Sent: Wednesday, February 20, 2013 11:10 PM
Subject: Re: [Kde-bindings] [Qyoto] crash when using QList returned by QMimeData.Urls
 
On 2/19/2013 9:43 PM, David Lechner wrote:
> So now, the question is where do I need to tell the native code to not
> destroy my QUrl object?

I have made some progress. I have found that marshall_ValueListItem() is deleting the QList object.

>             if (m->type().isStack()) {
>                delete valuelist;
>            }

which in turn deletes all of the items in the list. So, my solution is to copy each item in the list when we are marshaling here.

I am using the new keyword to keep this copy from being destroyed. I assume that C# will call delete on the native object when the C# object is GCed.

I have attached the patch that fixes this (in combination with the other patch I already posted)


_______________________________________________
Kde-bindings mailing list
Kde-bindings at kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20130220/5610e03b/attachment.html>


More information about the Kde-bindings mailing list