aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlxmlhttprequest.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2014-11-13 21:38:25 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-11-21 19:32:23 +0100
commit2784a68d64519ccc5d01b6c1378207572cf1ebcd (patch)
treeb66287687e7311a24253d60e18bcba829fb475ad /src/qml/qml/qqmlxmlhttprequest.cpp
parent2cb6d1bf32e017026f618dcfdbef3980f5363656 (diff)
Cleanup destruction of heap objects
Generate the code from a macro instead of duplicating boiler plate code. Operate on Heap::Base instead of Managed. Change-Id: I84c5a705980899be3e5b931a093645e50d3923bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlxmlhttprequest.cpp')
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 0083d2353c..b84c878d53 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -216,14 +216,12 @@ class NamedNodeMap : public Object
{
public:
V4_OBJECT2(NamedNodeMap, Object)
+ V4_NEEDS_DESTROY
// C++ API
static ReturnedValue create(QV8Engine *, NodeImpl *, const QList<NodeImpl *> &);
// JS API
- static void destroy(Managed *that) {
- static_cast<NamedNodeMap *>(that)->d()->~Data();
- }
static ReturnedValue get(Managed *m, String *name, bool *hasProperty);
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
};
@@ -245,11 +243,9 @@ class NodeList : public Object
{
public:
V4_OBJECT2(NodeList, Object)
+ V4_NEEDS_DESTROY
// JS API
- static void destroy(Managed *that) {
- static_cast<NodeList *>(that)->d()->~Data();
- }
static ReturnedValue get(Managed *m, String *name, bool *hasProperty);
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
@@ -328,12 +324,7 @@ DEFINE_OBJECT_VTABLE(NodePrototype);
struct Node : public Object
{
V4_OBJECT2(Node, Object)
-
-
- // JS API
- static void destroy(Managed *that) {
- static_cast<Node *>(that)->d()->~Data();
- }
+ V4_NEEDS_DESTROY
// C++ API
static ReturnedValue create(QV8Engine *, NodeImpl *);
@@ -1629,10 +1620,7 @@ struct QQmlXMLHttpRequestCtor : FunctionObject {
struct QQmlXMLHttpRequestWrapper : public Object
{
V4_OBJECT2(QQmlXMLHttpRequestWrapper, Object)
-
- static void destroy(Managed *that) {
- static_cast<QQmlXMLHttpRequestWrapper *>(that)->d()->~Data();
- }
+ V4_NEEDS_DESTROY
};
Heap::QQmlXMLHttpRequestWrapper::QQmlXMLHttpRequestWrapper(ExecutionEngine *engine, QQmlXMLHttpRequest *request)