summaryrefslogtreecommitdiffstats
path: root/PySide/QtDeclarative/pysideqmlregistertype.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-01-04 18:46:40 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2011-01-04 19:25:31 -0200
commit15dd2e07edd4d1114bd8651987327e3ebc9ba6a6 (patch)
treeb476e6c61a0f8fcfbae94172190b69bc56f9889e /PySide/QtDeclarative/pysideqmlregistertype.cpp
parent3774752f0c254433eeacaeccb4abb25b2d255148 (diff)
downloadpyside-15dd2e07edd4d1114bd8651987327e3ebc9ba6a6.tar.gz
pyside-15dd2e07edd4d1114bd8651987327e3ebc9ba6a6.tar.xz
pyside-15dd2e07edd4d1114bd8651987327e3ebc9ba6a6.zip
Lock the gil on some hand written code to avoid crashes.
Reviewer: Renato Ara├║jo <renato.filho@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'PySide/QtDeclarative/pysideqmlregistertype.cpp')
-rw-r--r--PySide/QtDeclarative/pysideqmlregistertype.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/PySide/QtDeclarative/pysideqmlregistertype.cpp b/PySide/QtDeclarative/pysideqmlregistertype.cpp
index 362e56d..0b05758 100644
--- a/PySide/QtDeclarative/pysideqmlregistertype.cpp
+++ b/PySide/QtDeclarative/pysideqmlregistertype.cpp
@@ -27,6 +27,7 @@
#include <QMutex>
// shiboken
#include <typeresolver.h>
+#include <gilstate.h>
#include <sbkdbg.h>
// pyside
#include <pyside.h>
@@ -63,6 +64,7 @@ struct ElementFactoryBase
{
QMutexLocker locker(&nextQmlElementMutex);
PySide::nextQmlElementMemoryAddr = memory;
+ Shiboken::GilState state;
PyObject* obj = PyObject_CallObject(pyTypes[N], 0);
if (!obj || PyErr_Occurred())
PyErr_Print();
@@ -246,6 +248,7 @@ PyTypeObject PropertyListType = {
// Implementation of QDeclarativeListProperty<T>::AppendFunction callback
void propListAppender(QDeclarativeListProperty<QDeclarativeItem>* propList, QDeclarativeItem* item)
{
+ Shiboken::GilState state;
Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object, item));
DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(propList->data);
@@ -258,6 +261,7 @@ void propListAppender(QDeclarativeListProperty<QDeclarativeItem>* propList, QDec
// Implementation of QDeclarativeListProperty<T>::CountFunction callback
int propListCount(QDeclarativeListProperty<QDeclarativeItem>* propList)
{
+ Shiboken::GilState state;
Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object));
DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(propList->data);
@@ -275,6 +279,7 @@ int propListCount(QDeclarativeListProperty<QDeclarativeItem>* propList)
// Implementation of QDeclarativeListProperty<T>::AtFunction callback
QDeclarativeItem* propListAt(QDeclarativeListProperty<QDeclarativeItem>* propList, int index)
{
+ Shiboken::GilState state;
Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object, index));
DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(propList->data);
@@ -291,6 +296,7 @@ QDeclarativeItem* propListAt(QDeclarativeListProperty<QDeclarativeItem>* propLis
// Implementation of QDeclarativeListProperty<T>::ClearFunction callback
void propListClear(QDeclarativeListProperty<QDeclarativeItem>* propList)
{
+ Shiboken::GilState state;
Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object));
DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(propList->data);