[Kde-bindings] Qyoto and QTreeView/QAbstractItemModel: "C# instance has been wrongly GC'd for virtual call"

Steven Boswell II ulatekh at yahoo.com
Mon Nov 28 17:27:50 UTC 2011


On Friday 18 November 2011 12:06:34 Steven Boswell II wrote:
>On Saturday, November 19, 2011 6:31 AM Arno Rehn wrote:

>> It seems to me that anything passed to QTreeView.SetModel() should be
>> accounted for within Mono's memory-management system, and not get
>> garbage-collected behind its back.
>
>Yes, but that's a little difficult. The setModel() call will not take ownership 
>of the model, because it might be shared between multiple views (see 
>http://doc.qt.nokia.com/latest/qabstractitemview.html#setModel
>for reference).

Is that relevant for C#?  Granted, I'm still learning C#, but I did a lot of work with garbage-collection back in my formative years, and it seems to me that QAbstractItemView should refer to its currently-set model with a pointer type that's relevant to C#'s garbage collection.  The advice given in the above link seems to be relevant for non-garbage-collected languages like C++.

I'm getting a similar problem when trying to connect a "currentRowChanged(QModelIndex, QModelIndex)" signal on a QTreeView's selection model.  I haven't figured out how to work around that one, though.

>> Qt and C# seem like a powerful combo
>> for cross-platform application development.
>
>Yes, C# and Qt fit very nicely. However, nearly no-one in the *nix world cares 
>about the whole Mono thing (actually, nearly everyone dislikes it) - so it was 
>never seriously used by anyone.

That's a shame.  C# certainly has its place -- it seems to be handy for a lot of application-development tasks where the full, raw, low-level power of C++ isn't needed.  Plus, Mono's existence means it's no longer a Microsoft-only language, so there's less of a religious problem there.

From what I can tell, Qyoto doesn't currently run under Windows.  Is that true, or is that information out of date?  I already have two serious uses of multiplatform Qyoto -- one for my job, one for an open-source project.  Currently, the plan is to prototype the interfaces with Qyoto running under Linux, then rewrite them using WinForms so that they'll run under Windows, but I'm not looking forward to that.

Steven Boswell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20111128/9eb96e1f/attachment.html>


More information about the Kde-bindings mailing list