diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2018-12-21 11:34:57 +0100 |
---|---|---|
committer | Robert Griebl <robert.griebl@pelagicore.com> | 2019-01-12 12:29:35 +0000 |
commit | 5bca991b07903942fb48450f3e867b5a3c30d1e5 (patch) | |
tree | 386f1ac699be210ccb4fdf1780fa024ae5a09ebd /src/ivicore/qivisimulationproxy.cpp | |
parent | 34e23de0523e0a4250584a74d56cab35ca28f3a7 (diff) |
Fix a crash in the QIviSimulationEngine when using animations
The code handles now read and write of properties using the
staticMetaObject correctly.
Added more internal documentation for it and a autotest.
Change-Id: Iddceeebcf5317ddb3a6986d82febc81bd374b575
Fixes: AUTOSUITE-727
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
Diffstat (limited to 'src/ivicore/qivisimulationproxy.cpp')
-rw-r--r-- | src/ivicore/qivisimulationproxy.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ivicore/qivisimulationproxy.cpp b/src/ivicore/qivisimulationproxy.cpp index 8800f78..7f2ab00 100644 --- a/src/ivicore/qivisimulationproxy.cpp +++ b/src/ivicore/qivisimulationproxy.cpp @@ -82,6 +82,18 @@ int QIviSimulationProxyBase::qt_metacall(QMetaObject::Call call, int methodId, v if (m_noSimulationEngine) return -1; + // Special handling for the artificial "Base" property. + // All other properties are forwarded to the qt_metacall generated by moc which translates the + // absolute id's back to relative ones + if (call == QMetaObject::ReadProperty || call == QMetaObject::WriteProperty) { + int basePropertyIndex = m_staticMetaObject->indexOfProperty("Base"); + if (methodId == basePropertyIndex) { + void *_v = a[0]; + *reinterpret_cast< QObject**>(_v) = m_instance; + return -1; + } + } + if (call == QMetaObject::InvokeMetaMethod) { // When a forwarded signal from the registered instance gets in. Directly call the signal here as well if (sender() == m_instance) { @@ -89,6 +101,8 @@ int QIviSimulationProxyBase::qt_metacall(QMetaObject::Call call, int methodId, v QMetaObject::activate(this, m_staticMetaObject, methodId - m_staticMetaObject->methodOffset(), a); return 0; } + // As we don't derive from the MetaObject of m_instance, we need to use the methodMap to + // translate our methodId to the methodId for m_instance return m_instance->qt_metacall(call, m_methodMap.key(methodId), a); } return m_instance->qt_metacall(call, methodId, a); |