Details
Description
As of e1d4fabc5d2f7ec5a2f84a6c7c76cdb054552ca6, qtscript has some fragile dependencies on the layout of QObject's metaobject. It makes assumptions which are not verified at compile time or runtime, which can lead to incorrect behavior if QObject is changed (e.g. by adding/removing signals/slots).
For example, this code:
// src/script/bridge/qscriptqobject.cpp static bool hasMethodAccess(const QMetaMethod &method, int index, const QScriptEngine::QObjectWrapOptions &opt) { return (method.access() != QMetaMethod::Private) && ((index != 2) || !(opt & QScriptEngine::ExcludeDeleteLater)) && (!(opt & QScriptEngine::ExcludeSlots) || (method.methodType() != QMetaMethod::Slot)); }
...assumes that deleteLater() is the metamethod at index 2 in QObject's metaobject (which is actually false since qtbase ba635d7e74472f3a54c0c4686966af46d9035c6f).
The tst_qscriptextqobject autotest also makes assumptions about QObject's metaobject, but I think this is OK (it seems the most practical way to write the test, and if the metaobject changes then the test starts to fail and can easily be updated).
Attachments
For Gerrit Dashboard: QTBUG-23502 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
12342,2 | Fix QScriptEngine::ExcludeDeleteLater and metaobject-related autotests | master | qt/qtscript | Status: MERGED | +2 | 0 |