From 58dc831e557eb533bf40c9ff7b79d01d58b6de98 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 6 Jan 2012 13:20:38 +1000 Subject: 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 Reviewed-by: Bradley T. Hughes --- src/script/bridge/qscriptqobject.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/script/bridge/qscriptqobject.cpp') 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)); } -- cgit v1.2.1