From: Matthew Vogt Date: Fri, 4 May 2012 01:55:00 +0000 (+1000) Subject: Consistent use of syntax in V4 Register class X-Git-Tag: 071012131707~83 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=17910705ee02744edc968f7bc7de2a2d652483dd;p=profile%2Fivi%2Fqtdeclarative.git Consistent use of syntax in V4 Register class Use the construction/destruction wrapper functions consistently. These are required for template types because the syntax to invoke the destructor directly confuses GCC. Change-Id: I4a6c9239972a96f84a601b4f4a8aeebfd75044a9 Reviewed-by: Michael Brasser --- diff --git a/src/qml/qml/v4/qv4bindings.cpp b/src/qml/qml/v4/qv4bindings.cpp index 7d42b47..f011bc8 100644 --- a/src/qml/qml/v4/qv4bindings.cpp +++ b/src/qml/qml/v4/qv4bindings.cpp @@ -188,17 +188,17 @@ void Register::cleanup() { if (dataType >= FirstCleanupType) { if (dataType == QStringType) { - getstringptr()->~QString(); + destroyPointee(getstringptr()); } else if (dataType == QUrlType) { - geturlptr()->~QUrl(); + destroyPointee(geturlptr()); } else if (dataType == QColorType) { QQml_valueTypeProvider()->destroyValueType(QMetaType::QColor, typeDataPtr(), dataSize()); } else if (dataType == QVariantType) { - getvariantptr()->~QVariant(); + destroyPointee(getvariantptr()); } else if (dataType == qMetaTypeId >()) { destroyPointee(gethandleptr()); } else if (dataType == qMetaTypeId()) { - getjsvalueptr()->~QJSValue(); + destroyPointee(getjsvalueptr()); } } setUndefined(); @@ -206,13 +206,13 @@ void Register::cleanup() void Register::cleanupString() { - getstringptr()->~QString(); + destroyPointee(getstringptr()); setUndefined(); } void Register::cleanupUrl() { - geturlptr()->~QUrl(); + destroyPointee(geturlptr()); setUndefined(); } @@ -224,7 +224,7 @@ void Register::cleanupColor() void Register::cleanupVariant() { - getvariantptr()->~QVariant(); + destroyPointee(getvariantptr()); setUndefined(); } @@ -236,7 +236,7 @@ void Register::cleanupHandle() void Register::cleanupJSValue() { - getjsvalueptr()->~QJSValue(); + destroyPointee(getjsvalueptr()); setUndefined(); } @@ -245,17 +245,17 @@ void Register::copy(const Register &other) *this = other; if (other.dataType >= FirstCleanupType) { if (other.dataType == QStringType) - new (getstringptr()) QString(*other.getstringptr()); + copyConstructPointee(getstringptr(), other.getstringptr()); else if (other.dataType == QUrlType) - new (geturlptr()) QUrl(*other.geturlptr()); + copyConstructPointee(geturlptr(), other.geturlptr()); else if (other.dataType == QColorType) QQml_valueTypeProvider()->copyValueType(QMetaType::QColor, other.typeDataPtr(), typeDataPtr(), dataSize()); else if (other.dataType == QVariantType) - new (getvariantptr()) QVariant(*other.getvariantptr()); + copyConstructPointee(getvariantptr(), other.getvariantptr()); else if (other.dataType == qMetaTypeId >()) copyConstructPointee(gethandleptr(), other.gethandleptr()); else if (other.dataType == qMetaTypeId()) - new (getjsvalueptr()) QJSValue(*other.getjsvalueptr()); + copyConstructPointee(getjsvalueptr(), other.getjsvalueptr()); } } @@ -264,17 +264,17 @@ void Register::init(Type type) dataType = type; if (dataType >= FirstCleanupType) { if (dataType == QStringType) - new (getstringptr()) QString(); + defaultConstructPointee(getstringptr()); else if (dataType == QUrlType) - new (geturlptr()) QUrl(); + defaultConstructPointee(geturlptr()); else if (dataType == QColorType) QQml_valueTypeProvider()->initValueType(QMetaType::QColor, typeDataPtr(), dataSize()); else if (dataType == QVariantType) - new (getvariantptr()) QVariant(); + defaultConstructPointee(getvariantptr()); else if (dataType == qMetaTypeId >()) defaultConstructPointee(gethandleptr()); else if (dataType == qMetaTypeId()) - new (getjsvalueptr()) QJSValue(); + defaultConstructPointee(getjsvalueptr()); } }