[Kde-bindings] Moving the Qyoto C# bindings from playground to kdebindings

Richard Dale rdale at foton.es
Wed Apr 11 16:27:33 UTC 2007


On Wednesday 11 April 2007, Richard Dale wrote:
> On Wednesday 11 April 2007, Arno Rehn wrote:
> > I found out about a little bug in the GetHashCode() stuff of the Qyoto
> > classes. When you call the method of certain classes, e.g. QTextBlock,
> > the whole app segfaults with no further output. I would just return the
> > real pointer to the underlying C++ object, this would always be unique
> > and would work, wouldn't it?
>
> Yes, that's exactly what I was intending it to do. But I was wondering
> about 64 bit pointers though, if the hash is an int.
Just been looking in the Qt libs, and there's a qHash() function in the QHash 
class that takes a ulong and returns a uint:

inline uint qHash(ulong key)
{
    if (sizeof(ulong) > sizeof(uint)) {
        return uint((key >> (8 * sizeof(uint) - 1)) ^ key);
    } else {
        return uint(key);
    }
}

So maybe calling that on the C++ pointer would be good enough.

-- Richard



More information about the Kde-bindings mailing list