<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>I'm having a heck of a time understanding the source code, given that it's not documented in any significant way, but the first obvious thing I noticed is that, in all of the marshalling functions that call mapPointer(), none of them call unmapPointer(); instead, they call FreeGCHandle directly.  Could that be the source of the problem?</span></div><div><br></div>  <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Dimitar Dobrev <dpldobrev@yahoo.com><br> <b><span style="font-weight: bold;">To:</span></b> KDE bindings <kde-bindings@kde.org> <br> <b><span
 style="font-weight: bold;">Sent:</span></b> Wednesday, June 13, 2012 3:51 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> [Kde-bindings] Qyoto: showstopper bug - help needed<br> </font> </div> <br>
<div id="yiv1528097991"><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "><div>Hi all,</div><div><br></div><div>The workaround for the bug causing an invalid cast - the commenting out of the mappointer call in qyoto-qtcore/native/handlers.cpp - is not correct because it causes different managed objects to be returned for subsequent calls to the same property. So this bug has to be fixed otherwise Qyoto is completely useless. Please, if anyone has any idea, it would be of help. Here are my few findings:</div><div><br></div><div>1. The mentioned hack gives some hint what might be wrong - I think that the problem is that initially the wrong object is constructed but as it is not saved when it is being requested it is created anew, and this time correctly; this, I believe, is confirmed by a QDropEvent with type() == QEvent.Type.QDragMove that is tried to be
 passed to a QDragMove event handler; that is, the
 type() method gives the correct result but the object type (QDropEvent) is wrong;<br></div><div>2. Subsequent calls to failing methods work properly. For example on my machine this method in QSize:</div><div><br></div><div>        public new QSize ExpandedTo(QSize arg1) {<br>            object[] smokeArgs = new object[] {<br>                    typeof(QSize),<br>                    arg1};<br>            return ((QSize)(this.interceptor.Invoke("expandedTo#", "expandedTo(const QSize&) const", typeof(QSize), false, smokeArgs)));<br>        }</div><div><br></div><div>may crash with "Unable
 to cast object of type 'Qyoto.QItemSelectionModel' to type 'Qyoto.QSize'." but if I call it again (tried this a few times in the Visual Studio watch window) the error doesn't appear any more, that is, the correct type is returned.<br></div></div></div></div><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>