summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrenatofilho <renato.filho@openbossa.org>2010-11-01 11:04:56 -0300
committerrenatofilho <renato.filho@openbossa.org>2010-11-03 10:29:35 -0300
commit5b0606009d478cf01d9b3d25110352823cdce0f4 (patch)
treeaf37a5ce640e53bb3ad658bbb38bf188f2b9eb75
parent4cd7a240d8db7de44b471a8ef0ed2f956addb743 (diff)
downloadpyside-5b0606009d478cf01d9b3d25110352823cdce0f4.tar.gz
pyside-5b0606009d478cf01d9b3d25110352823cdce0f4.tar.xz
pyside-5b0606009d478cf01d9b3d25110352823cdce0f4.zip
Fixed metacall function adn PyGil state handle.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Lauro Neto <lauro.neto@openbossa.org>
-rw-r--r--libpyside/signalmanager.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp
index a8ee412..98dd0b1 100644
--- a/libpyside/signalmanager.cpp
+++ b/libpyside/signalmanager.cpp
@@ -135,6 +135,7 @@ void SignalManager::clear()
{
delete m_d;
m_d = new SignalManagerPrivate();
+ m_d.reset();
}
SignalManager::~SignalManager()
@@ -243,14 +244,16 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
PyObject* pp_name = 0;
QMetaProperty mp;
Shiboken::TypeResolver* typeResolver = 0;
- PyObject* pySelf = Shiboken::BindingManager::instance().retrieveWrapper(object);
- Q_ASSERT(pySelf);
+ PyObject* pySelf = 0;
if (call != QMetaObject::InvokeMetaMethod) {
mp = metaObject->property(id);
if (!mp.isValid())
return id - metaObject->methodCount();
+ Shiboken::GilState gil;
+ pySelf = Shiboken::BindingManager::instance().retrieveWrapper(object);
+ Q_ASSERT(pySelf);
pp_name = PyString_FromString(mp.name());
pp = Property::getObject(pySelf, pp_name);
if (!pp) {
@@ -266,6 +269,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
#ifndef QT_NO_PROPERTIES
case QMetaObject::ReadProperty:
{
+ Shiboken::GilState gil;
PyObject* value = Property::getValue(pp, pySelf);
if (value) {
typeResolver->toCpp(value, &args[0]);
@@ -278,14 +282,18 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
case QMetaObject::WriteProperty:
{
+ Shiboken::GilState gil;
Shiboken::AutoDecRef value(typeResolver->toPython(args[0]));
Property::setValue(pp, pySelf, value);
break;
}
case QMetaObject::ResetProperty:
+ {
+ Shiboken::GilState gil;
Property::reset(pp, pp_name);
break;
+ }
case QMetaObject::QueryPropertyDesignable:
case QMetaObject::QueryPropertyScriptable:
@@ -307,8 +315,11 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
else
id = id - metaObject->propertyCount();
- Py_XDECREF(pp);
- Py_XDECREF(pp_name);
+ if (pp || pp_name) {
+ Shiboken::GilState gil;
+ Py_XDECREF(pp);
+ Py_XDECREF(pp_name);
+ }
return id;
}