Fix call to QMetaObject::metaCall from updateProperty

Create an array of arguments in the same way
QMetaObject::write does

Task-number: QTBUG-29082
Change-Id: I4ea5ab5dcd6b55cf0a127b855b5aac27a9d4a305
Reviewed-by: Davide Pesavento <davidepesa@gmail.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
David E. Narváez 2013-02-03 23:07:07 -05:00 committed by The Qt Project
parent eaa18f3063
commit f0221d3594

View File

@ -136,8 +136,11 @@ void QPropertyAnimationPrivate::updateProperty(const QVariant &newValue)
if (newValue.userType() == propertyType) {
//no conversion is needed, we directly call the QMetaObject::metacall
void *data = const_cast<void*>(newValue.constData());
QMetaObject::metacall(targetValue, QMetaObject::WriteProperty, propertyIndex, &data);
//check QMetaProperty::write for an explanation of these
int status = -1;
int flags = 0;
void *argv[] = { const_cast<void *>(newValue.constData()), const_cast<QVariant *>(&newValue), &status, &flags };
QMetaObject::metacall(targetValue, QMetaObject::WriteProperty, propertyIndex, argv);
} else {
targetValue->setProperty(propertyName.constData(), newValue);
}