Review Request 128205: Fix crash when a method exposed to Kross returns QVariant with non-relocatable data
Alexander Potashev
aspotashev at gmail.com
Fri Jun 17 00:25:27 UTC 2016
> On Июнь 17, 2016, 12:42 д.п., Albert Astals Cid wrote:
> > How hard is to add a unit test to prove this is needed+so it doesn't break again in the future?
I've added this Python test case: http://commits.kde.org/kross-interpreters/b5a9d7320d02b5cbaa4cbef25341851849cc9d7a
It's possible to add the same into the qtscript unit test (in kross.git), but don't think it should be a priority.
- Alexander
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128205/#review96613
-----------------------------------------------------------
On Июнь 16, 2016, 1:04 п.п., Alexander Potashev wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128205/
> -----------------------------------------------------------
>
> (Updated Июнь 16, 2016, 1:04 п.п.)
>
>
> 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/20160617/633f4422/attachment.html>
More information about the Kde-frameworks-devel
mailing list