<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab">    Thank you. </span>However, there is one last detail - could you make sure it works with the GetInstance call. I mean like this:</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab">    <br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab">                void *p = (void *)
 &(valuelist->at(i));<br>                void * obj = (*GetInstance)(p, true);<br><br>                if (obj == 0) {</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab">                    </span><span class="tab"></span><span class="tab">p = (void *) new Item(*(Item*) p);<br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab">    </span><span class="tab">    </span><span class="tab">    </span><span class="tab">    </span><span
 class="tab">    </span><span class="tab">smokeqyoto_object * o = alloc_smokeqyoto_object(false, ix.smoke, ix.index, p);<br>                    obj = (*CreateInstance)(qyoto_resolve_classname(o), o);<br>                }</span><span class="tab">    <br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span class="tab"></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab">    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.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span class="tab"></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab">    Regards,</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab">    Dimitar</span><span class="tab">    </span></div><div><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york,
 times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> David Lechner <david@lechnology.com><br> <b><span style="font-weight: bold;">To:</span></b> kde-bindings@kde.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, February 20, 2013 11:10 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Kde-bindings] [Qyoto] crash when using QList returned by QMimeData.Urls<br> </font> </div> <br>
On 2/19/2013 9:43 PM, David Lechner wrote:<br>> So now, the question is where do I need to tell the native code to not<br>> destroy my QUrl object?<br><br>I have made some progress. I have found that marshall_ValueListItem() is deleting the QList object.<br><br>>             if (m->type().isStack()) {<br>>                delete valuelist;<br>>            }<br><br>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.<br><br>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.<br><br>I have attached the patch that fixes this (in combination with the other patch I already
 posted)<br><br><br>_______________________________________________<br>Kde-bindings mailing list<br><a ymailto="mailto:Kde-bindings@kde.org" href="mailto:Kde-bindings@kde.org">Kde-bindings@kde.org</a><br><a href="https://mail.kde.org/mailman/listinfo/kde-bindings" target="_blank">https://mail.kde.org/mailman/listinfo/kde-bindings</a><br><br><br> </div> </div>  </div></body></html>