Fixed metacall function adn PyGil state handle.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Lauro Neto <lauro.neto@openbossa.org>
This commit is contained in:
parent
4cd7a240d8
commit
5b0606009d
1 changed files with 15 additions and 4 deletions
|
|
@ -135,6 +135,7 @@ void SignalManager::clear()
|
||||||
{
|
{
|
||||||
delete m_d;
|
delete m_d;
|
||||||
m_d = new SignalManagerPrivate();
|
m_d = new SignalManagerPrivate();
|
||||||
|
m_d.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
SignalManager::~SignalManager()
|
SignalManager::~SignalManager()
|
||||||
|
|
@ -243,14 +244,16 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
|
||||||
PyObject* pp_name = 0;
|
PyObject* pp_name = 0;
|
||||||
QMetaProperty mp;
|
QMetaProperty mp;
|
||||||
Shiboken::TypeResolver* typeResolver = 0;
|
Shiboken::TypeResolver* typeResolver = 0;
|
||||||
PyObject* pySelf = Shiboken::BindingManager::instance().retrieveWrapper(object);
|
PyObject* pySelf = 0;
|
||||||
Q_ASSERT(pySelf);
|
|
||||||
|
|
||||||
if (call != QMetaObject::InvokeMetaMethod) {
|
if (call != QMetaObject::InvokeMetaMethod) {
|
||||||
mp = metaObject->property(id);
|
mp = metaObject->property(id);
|
||||||
if (!mp.isValid())
|
if (!mp.isValid())
|
||||||
return id - metaObject->methodCount();
|
return id - metaObject->methodCount();
|
||||||
|
|
||||||
|
Shiboken::GilState gil;
|
||||||
|
pySelf = Shiboken::BindingManager::instance().retrieveWrapper(object);
|
||||||
|
Q_ASSERT(pySelf);
|
||||||
pp_name = PyString_FromString(mp.name());
|
pp_name = PyString_FromString(mp.name());
|
||||||
pp = Property::getObject(pySelf, pp_name);
|
pp = Property::getObject(pySelf, pp_name);
|
||||||
if (!pp) {
|
if (!pp) {
|
||||||
|
|
@ -266,6 +269,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
|
||||||
#ifndef QT_NO_PROPERTIES
|
#ifndef QT_NO_PROPERTIES
|
||||||
case QMetaObject::ReadProperty:
|
case QMetaObject::ReadProperty:
|
||||||
{
|
{
|
||||||
|
Shiboken::GilState gil;
|
||||||
PyObject* value = Property::getValue(pp, pySelf);
|
PyObject* value = Property::getValue(pp, pySelf);
|
||||||
if (value) {
|
if (value) {
|
||||||
typeResolver->toCpp(value, &args[0]);
|
typeResolver->toCpp(value, &args[0]);
|
||||||
|
|
@ -278,14 +282,18 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
|
||||||
|
|
||||||
case QMetaObject::WriteProperty:
|
case QMetaObject::WriteProperty:
|
||||||
{
|
{
|
||||||
|
Shiboken::GilState gil;
|
||||||
Shiboken::AutoDecRef value(typeResolver->toPython(args[0]));
|
Shiboken::AutoDecRef value(typeResolver->toPython(args[0]));
|
||||||
Property::setValue(pp, pySelf, value);
|
Property::setValue(pp, pySelf, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case QMetaObject::ResetProperty:
|
case QMetaObject::ResetProperty:
|
||||||
|
{
|
||||||
|
Shiboken::GilState gil;
|
||||||
Property::reset(pp, pp_name);
|
Property::reset(pp, pp_name);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case QMetaObject::QueryPropertyDesignable:
|
case QMetaObject::QueryPropertyDesignable:
|
||||||
case QMetaObject::QueryPropertyScriptable:
|
case QMetaObject::QueryPropertyScriptable:
|
||||||
|
|
@ -307,8 +315,11 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
|
||||||
else
|
else
|
||||||
id = id - metaObject->propertyCount();
|
id = id - metaObject->propertyCount();
|
||||||
|
|
||||||
Py_XDECREF(pp);
|
if (pp || pp_name) {
|
||||||
Py_XDECREF(pp_name);
|
Shiboken::GilState gil;
|
||||||
|
Py_XDECREF(pp);
|
||||||
|
Py_XDECREF(pp_name);
|
||||||
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue