aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4qobjectwrapper_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4qobjectwrapper_p.h')
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index 37397db55b..727af6c9c6 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -78,7 +78,7 @@ namespace Heap {
struct QQmlValueTypeWrapper;
struct QObjectWrapper : Object {
- QObjectWrapper(QObject *object);
+ void init(QObject *object);
void destroy() { qObj.destroy(); }
QObject *object() const { return qObj.data(); }
@@ -88,16 +88,22 @@ private:
};
struct QObjectMethod : FunctionObject {
- QObjectMethod(QV4::ExecutionContext *scope);
+ void init(QV4::ExecutionContext *scope);
void destroy()
{
- propertyCache = nullptr;
+ setPropertyCache(nullptr);
qObj.destroy();
FunctionObject::destroy();
}
- QQmlRefPointer<QQmlPropertyCache> propertyCache;
- int index;
+ QQmlPropertyCache *propertyCache() const { return _propertyCache; }
+ void setPropertyCache(QQmlPropertyCache *c) {
+ if (c)
+ c->addref();
+ if (_propertyCache)
+ _propertyCache->release();
+ _propertyCache = c;
+ }
Pointer<QQmlValueTypeWrapper> valueTypeWrapper;
@@ -107,6 +113,10 @@ struct QObjectMethod : FunctionObject {
private:
QQmlQPointer<QObject> qObj;
+ QQmlPropertyCache *_propertyCache;
+
+public:
+ int index;
};
struct QMetaObjectWrapper : FunctionObject {
@@ -114,13 +124,13 @@ struct QMetaObjectWrapper : FunctionObject {
QQmlPropertyData *constructors;
int constructorCount;
- QMetaObjectWrapper(const QMetaObject* metaObject);
+ void init(const QMetaObject* metaObject);
void destroy();
void ensureConstructorsCache();
};
struct QmlSignalHandler : Object {
- QmlSignalHandler(QObject *object, int signalIndex);
+ void init(QObject *object, int signalIndex);
void destroy() { qObj.destroy(); }
int signalIndex;