diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-09-09 12:18:55 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2014-09-10 21:10:57 +0200 |
commit | 6316a681f3f3dde46d5ab5c915f31a2098b463bb (patch) | |
tree | cb94be60559848ae8388b6cadf84c82d37af1bf4 /src/corelib/kernel/qvariant.cpp | |
parent | df25927a6827c0abce6d35440359a835d23226f7 (diff) | |
download | qtbase-6316a681f3f3dde46d5ab5c915f31a2098b463bb.tar.gz |
Fix user defined conversions to numeric types
The old code was completely broken. It did dereference
val for user types, but val does in this case only contain
garbage. Instead use the pointer to the correct data.
Change-Id: I20ccf0bfa3dd3774c787d08c51cc8dd7b1ec9a1a
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'src/corelib/kernel/qvariant.cpp')
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 29734f902e..5f17b234f2 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2462,9 +2462,8 @@ inline T qNumVariantToHelper(const QVariant::Private &d, T ret = 0; if ((d.type >= QMetaType::User || t >= QMetaType::User) - && QMetaType::convert(&val, d.type, &ret, t)) { + && QMetaType::convert(constData(d), d.type, &ret, t)) return ret; - } if (!handlerManager[d.type]->convert(&d, t, &ret, ok) && ok) *ok = false; |