Review Request 128205: Fix crash when a method exposed to Kross returns QVariant with non-relocatable data

Alexander Potashev aspotashev at gmail.com
Thu Jun 16 10:04:00 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128205/
-----------------------------------------------------------

Review request for KDE Frameworks and Friedrich W. H. Kossebau.


Repository: kross


Description
-------

In the Python2 interpreter plugin we constuct a QVariant from a typeId
and a pointer to the data. When a method returns e.g. a QVariantMap
in a QVariant, the typeId is QVariant::Map, but toVoidStar() used to
point to the memory where the wrapper QVariant was stored, but the QMap
is actually stored elsewhere, because QTypeInfo<QVariantMap>::isStatic
is true.

It wasn't crashing with Qt4 because in Qt4 QVariantMap was stored in the
QVariant's internal store (the C++ union).

We add template specialization MetaTypeVariant<QVariant> to handle
QVariants differently: now we directly return QVariant::data().


Diffs
-----

  src/core/metatype.h 5ffb9761377555bd0e664fa95828f1b43da7a9b3 

Diff: https://git.reviewboard.kde.org/r/128205/diff/


Testing
-------

This method does not crash anymore when called from a Python2 script:

    QVariant returnEmptyMap()
    {
        return QVariantMap();
    }


Thanks,

Alexander Potashev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160616/054f0cac/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list