[Kde-bindings] playground/bindings/kimono

Arno Rehn arno at arnorehn.de
Tue Mar 6 19:58:34 UTC 2007


Am Dienstag, 6. März 2007 schrieb Richard Dale:
> On Tuesday 06 March 2007, Richard Dale wrote:
> > > > The key WeakReference will always be alive because the value has a
> > > > GCHandle wrapping the key.
> > >
> > > Oops, ok, that's right.
> >
> > I just tried out my idea as code, and it doesn't work. Oh well. It gives
> > this output:
> >
> > Can't select indexes from different model or with different parents
> > topLeft.model: 0x84ef070 bottomRight.model: 0x84ef070
> > topLeft.parent().row(): 5 topLeft.parent().column(): 0
> > bottomRight.parent().row(): 5 bottomRight.parent().column(): 0
> > topLeft.parent().internalPointer(): 0x79f3
> > bottomRight.parent().internalPointer(): 0x79d3
> > topLeft.parent().model(): 0x84ef070 bottomRight.parent().model():
> > 0x84ef070
> >
> > So the two select points need to have the same parent still, although all
> > the details match. Hmm.. I don't understand how it works in Ruby now.
> > I've attached the patch of what I did anyway as that might be clearer
> > than trying to describe it.
>
> Ah, I forgot to add the struct with the GCHandle to the handleMap, oops..
> Once I did that it works fine. The reason I don't think we should use
> WeakReferences is that the QModelIndex 'owns' the reference in the
> internalPointer and shouldn't allow it to be GC'd. I added a fix to qtruby
> this morning exactly to prevent that happening.
Ok, great. I think I had some kind of mistake in my thinking, I thought for 
some reason the destructor of the QModelIndex wouldn't be called, but that's 
rubbish of course...
I think you can check that patch here in.

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list