Showing the changes to libraries/script-engine/src/v8/ScriptEngineV8_cast.cpp (1 of 2 files). Show all
Unified · Split
| @@ -344,6 +344,8 @@ bool ScriptEngineV8::castValueToVariant(const V8ScriptValue& v8Val, QVariant& de · 343 unmodified lines | |||
| 344 | if (demarshalFunc) { | 344 | if (demarshalFunc) { |
| 345 | dest = QVariant(destTypeId, static_cast<void*>(NULL)); | 345 | dest = QVariant(destTypeId, static_cast<void*>(NULL)); |
| 346 | ScriptValue wrappedVal(new ScriptValueV8Wrapper(this, v8Val)); | 346 | ScriptValue wrappedVal(new ScriptValueV8Wrapper(this, v8Val)); |
| 347 | Q_ASSERT(dest.constData() != nullptr); | ||
| 348 | //V8TODO: Data should never be written to dest.constData() according to Qt documentation. | ||
| 347 | bool success = demarshalFunc(wrappedVal, const_cast<void*>(dest.constData())); | 349 | bool success = demarshalFunc(wrappedVal, const_cast<void*>(dest.constData())); |
| 348 | if(!success) dest = QVariant(); | 350 | if(!success) dest = QVariant(); |
| 349 | return success; | 351 | return success; |
| @@ -689,6 +691,7 @@ V8ScriptValue ScriptEngineV8::castVariantToValue(const QVariant& val) { · 339 unmodified lines | |||
| 689 | _customTypeProtect.unlock(); | 691 | _customTypeProtect.unlock(); |
| 690 | } | 692 | } |
| 691 | if (marshalFunc) { | 693 | if (marshalFunc) { |
| 694 | Q_ASSERT(val.constData() != nullptr); | ||
| 692 | ScriptValue wrappedVal = marshalFunc(this, val.constData()); | 695 | ScriptValue wrappedVal = marshalFunc(this, val.constData()); |
| 693 | return ScriptValueV8Wrapper::fullUnwrap(this, wrappedVal); | 696 | return ScriptValueV8Wrapper::fullUnwrap(this, wrappedVal); |
| 694 | } | 697 | } |