aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/v8/qv8qobjectwrapper.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-11-02 14:28:02 +0000
committerQt by Nokia <qt-info@nokia.com>2011-11-04 11:27:52 +0100
commitf9261feb16d02e985982dd46783ea54c2cfce91b (patch)
tree205743bcd164628f882aa35580fd136384a28acb /src/declarative/qml/v8/qv8qobjectwrapper.cpp
parent0dd867535bebf6db673d4f03959e62e94ff35ba2 (diff)
Skip the captured properties step in bindings
Objects and notifiers in the capturedProperties list were not guarded which can lead to crashes if they're deleted prior to the binding completing. Now the notifiers are connected to and guarded immediately to prevent this. Change-Id: I912e323c52bf6169fb5077e552d5d38d9aa7faec Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/declarative/qml/v8/qv8qobjectwrapper.cpp')
-rw-r--r--src/declarative/qml/v8/qv8qobjectwrapper.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/declarative/qml/v8/qv8qobjectwrapper.cpp b/src/declarative/qml/v8/qv8qobjectwrapper.cpp
index 40cb021512..eea455d332 100644
--- a/src/declarative/qml/v8/qv8qobjectwrapper.cpp
+++ b/src/declarative/qml/v8/qv8qobjectwrapper.cpp
@@ -229,10 +229,8 @@ static v8::Handle<v8::Value> name ## ValueGetter(v8::Local<v8::String>, const v8
if (notify == 0x0FFF) notify = -1; \
\
QDeclarativeEnginePrivate *ep = resource->engine->engine()?QDeclarativeEnginePrivate::get(resource->engine->engine()):0; \
- if (ep && notify /* 0 means constant */ && ep->captureProperties) { \
- typedef QDeclarativeEnginePrivate::CapturedProperty CapturedProperty; \
- ep->capturedProperties << CapturedProperty(object, index, notify); \
- } \
+ if (ep && notify /* 0 means constant */ ) \
+ ep->captureProperty(object, index, notify); \
\
cpptype value = defaultvalue; \
void *args[] = { &value, 0 }; \
@@ -255,10 +253,8 @@ static v8::Handle<v8::Value> name ## ValueGetterDirect(v8::Local<v8::String>, co
if (notify == 0x0FFF) notify = -1; \
\
QDeclarativeEnginePrivate *ep = resource->engine->engine()?QDeclarativeEnginePrivate::get(resource->engine->engine()):0; \
- if (ep && notify /* 0 means constant */ && ep->captureProperties) { \
- typedef QDeclarativeEnginePrivate::CapturedProperty CapturedProperty; \
- ep->capturedProperties << CapturedProperty(object, index, notify); \
- } \
+ if (ep && notify /* 0 means constant */ ) \
+ ep->captureProperty(object, index, notify); \
\
cpptype value = defaultvalue; \
void *args[] = { &value, 0 }; \
@@ -508,8 +504,6 @@ v8::Handle<v8::Value> QV8QObjectWrapper::GetProperty(QV8Engine *engine, QObject
return v8::Handle<v8::Value>();
}
- typedef QDeclarativeEnginePrivate::CapturedProperty CapturedProperty;
-
if (result->isFunction()) {
if (result->isVMEFunction()) {
return ((QDeclarativeVMEMetaObject *)(object->metaObject()))->vmeMethod(result->coreIndex);
@@ -526,11 +520,11 @@ v8::Handle<v8::Value> QV8QObjectWrapper::GetProperty(QV8Engine *engine, QObject
}
QDeclarativeEnginePrivate *ep = engine->engine()?QDeclarativeEnginePrivate::get(engine->engine()):0;
- if (ep && ep->captureProperties && !result->isConstant()) {
+ if (ep && !result->isConstant()) {
if (result->coreIndex == 0)
- ep->capturedProperties << CapturedProperty(QDeclarativeData::get(object, true)->objectNameNotifier());
+ ep->captureProperty(QDeclarativeData::get(object, true)->objectNameNotifier());
else
- ep->capturedProperties << CapturedProperty(object, result->coreIndex, result->notifyIndex);
+ ep->captureProperty(object, result->coreIndex, result->notifyIndex);
}
if (result->isVMEProperty())