diff options
author | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2009-07-08 12:19:29 (GMT) |
---|---|---|
committer | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2009-07-08 14:48:20 (GMT) |
commit | 09303c005c1a41e0fb6bbf8375cdd72d46346a34 (patch) | |
tree | 69562bd202c92dd1730096d37564aa2b396922b2 /src/script/api/qscriptvalue.cpp | |
parent | c4c23b83d9ce6635b06fb570c30500c5da014111 (diff) | |
download | Qt-09303c005c1a41e0fb6bbf8375cdd72d46346a34.zip Qt-09303c005c1a41e0fb6bbf8375cdd72d46346a34.tar.gz Qt-09303c005c1a41e0fb6bbf8375cdd72d46346a34.tar.bz2 |
Fix engineDelete autotest.
Diffstat (limited to 'src/script/api/qscriptvalue.cpp')
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index bcbc3f7..b1e70b5 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -243,7 +243,7 @@ qsreal ToInteger(qsreal n) } // namespace QScript -QScriptValuePrivate::QScriptValuePrivate() +QScriptValuePrivate::QScriptValuePrivate() : engine(this), valid(true) { ref = 0; } @@ -252,6 +252,28 @@ QScriptValuePrivate::~QScriptValuePrivate() { } +QScriptValuePrivate::QScriptValueAutoRegister::QScriptValueAutoRegister(QScriptValuePrivate *value,const QScriptEngine *engine): + val(value), ptr(const_cast<QScriptEngine*>(engine)) +{ + QScriptEnginePrivate::get(ptr)->registerScriptValue(val); +} + +QScriptValuePrivate::QScriptValueAutoRegister::~QScriptValueAutoRegister() +{ + if (ptr) QScriptEnginePrivate::get(ptr)->unregisterScriptValue(val); +} + +QScriptValuePrivate::QScriptValueAutoRegister& QScriptValuePrivate::QScriptValueAutoRegister::operator=(const QScriptEngine *pointer) +{ + if (ptr) + QScriptEnginePrivate::get(ptr)->unregisterScriptValue(val); + ptr = const_cast<QScriptEngine*> (pointer); + if (ptr) + QScriptEnginePrivate::get(ptr)->registerScriptValue(val); + return *this; +}; + + void QScriptValuePrivate::initFromJSCValue(JSC::JSValue value) { type = JSC; @@ -2270,7 +2292,10 @@ bool QScriptValue::isQMetaObject() const bool QScriptValue::isValid() const { Q_D(const QScriptValue); - return (d != 0); + if (d) + return d->isValid(); + else + return false; } /*! |