summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2012-01-06 13:20:38 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-06 12:41:55 +0100
commit58dc831e557eb533bf40c9ff7b79d01d58b6de98 (patch)
tree8e51c0bd80ea091c8549fe34b9dc7f42a440b840 /src
parente1d4fabc5d2f7ec5a2f84a6c7c76cdb054552ca6 (diff)
downloadqtscript-58dc831e557eb533bf40c9ff7b79d01d58b6de98.tar.gz
Fix QScriptEngine::ExcludeDeleteLater and metaobject-related autotests
ba635d7e74472f3a54c0c4686966af46d9035c6f in qtbase adds a signal to QObject. This breaks some code in QtScript which hardcoded the list of expected metamethods on QObject, and some other code which hardcoded the index of the deleteLater slot. Fix it. This is a minimal fix which does not address the underlying fragility. Task-number: QTBUG-23502 Change-Id: Id1269f9d8af01e12587ba8ff2fecf942a7231aff Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/script/bridge/qscriptqobject.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index cee8319..6a9726a 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -151,8 +151,11 @@ private:
static bool hasMethodAccess(const QMetaMethod &method, int index, const QScriptEngine::QObjectWrapOptions &opt)
{
+ // FIXME: this is fragile and may break if signals/slots are added to/removed from QObject.
+ // See QTBUG-23502
+ const int deleteLaterIndex = 3;
return (method.access() != QMetaMethod::Private)
- && ((index != 2) || !(opt & QScriptEngine::ExcludeDeleteLater))
+ && ((index != deleteLaterIndex) || !(opt & QScriptEngine::ExcludeDeleteLater))
&& (!(opt & QScriptEngine::ExcludeSlots) || (method.methodType() != QMetaMethod::Slot));
}