summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-26 14:46:10 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-26 17:03:38 (GMT)
commita3ceb3627c0270274caa5818d34689b7bd81e2e3 (patch)
treed78106c1e921e5dccbd688b0ff8f6115e2dc8671 /src/script
parentf7709332d5ed16107e1bd8cbf07ab778e8f77217 (diff)
downloadQt-a3ceb3627c0270274caa5818d34689b7bd81e2e3.zip
Qt-a3ceb3627c0270274caa5818d34689b7bd81e2e3.tar.gz
Qt-a3ceb3627c0270274caa5818d34689b7bd81e2e3.tar.bz2
warn if QScriptValue::setScriptClass() is called on incompatible object
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/qscriptvalue.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index 7fd1efe..d5aaed7 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -2421,8 +2421,13 @@ QScriptClass *QScriptValue::scriptClass() const
void QScriptValue::setScriptClass(QScriptClass *scriptClass)
{
Q_D(QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject(&QScriptObject::info))
+ if (!d || !d->isObject())
return;
+ if (!d->jscValue.isObject(&QScriptObject::info)) {
+ qWarning("QScriptValue::setScriptClass() failed: "
+ "cannot change class of non-QScriptObject");
+ return;
+ }
QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue));
QScriptObjectDelegate *delegate = scriptObject->delegate();
if (!delegate || (delegate->type() != QScriptObjectDelegate::ClassObject)) {