summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason McCampbell (Enthought, Inc) <jmccampbell@enthought.com>2012-01-04 10:54:49 -0600
committerHugo Parente Lima <hugo.pl@gmail.com>2012-02-27 19:43:07 -0300
commit4e1be8c119c7611e1fdce08f670d63d673f04e0f (patch)
tree4a7c40dd36a335e08f68db773e4ca399052eead7
parent797c7b26d1e9c2dc3f7ca9aa48b50c349b732a8b (diff)
downloadpyside-4e1be8c119c7611e1fdce08f670d63d673f04e0f.tar.gz
pyside-4e1be8c119c7611e1fdce08f670d63d673f04e0f.tar.xz
pyside-4e1be8c119c7611e1fdce08f670d63d673f04e0f.zip
Fix bug 1110 - "Concurrency error causes GC heap corruption"
Random hang/crash at startup when display QWebView widget. Issue was that the GIL was not being acquired in a couple of calls, especially DynamicSlotDataV2::callback but in other locations as well. Reviewer: Hugo Parente Lima <hugo.pl@gmail.com>
-rw-r--r--libpyside/dynamicqmetaobject.cpp2
-rw-r--r--libpyside/globalreceiver.cpp3
-rw-r--r--libpyside/globalreceiverv2.cpp3
3 files changed, 8 insertions, 0 deletions
diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp
index 4dfd80f..abc115a 100644
--- a/libpyside/dynamicqmetaobject.cpp
+++ b/libpyside/dynamicqmetaobject.cpp
@@ -473,6 +473,8 @@ void DynamicQMetaObject::parsePythonType(PyTypeObject* type)
PyObject* value = 0;
Py_ssize_t pos = 0;
+ Shiboken::GilState gil;
+
typedef std::pair<const char*, PyObject*> PropPair;
QLinkedList<PropPair> properties;
diff --git a/libpyside/globalreceiver.cpp b/libpyside/globalreceiver.cpp
index ace1692..5639c3d 100644
--- a/libpyside/globalreceiver.cpp
+++ b/libpyside/globalreceiver.cpp
@@ -71,6 +71,8 @@ using namespace PySide;
DynamicSlotData::DynamicSlotData(int id, PyObject* callback, GlobalReceiver* parent)
: m_id(id), m_pythonSelf(0), m_pyClass(0), m_weakRef(0), m_parent(parent)
{
+ Shiboken::GilState gil;
+
m_isMethod = PyMethod_Check(callback);
if (m_isMethod) {
//Can not store calback pointe because this will be destroyed at the end of the scope
@@ -97,6 +99,7 @@ PyObject* DynamicSlotData::call(PyObject* args)
PyObject* callback = m_callback;
//create a callback based on method data
+ Shiboken::GilState gil;
if (m_isMethod)
#ifdef IS_PY3K
callback = PyMethod_New(callback, m_pythonSelf);
diff --git a/libpyside/globalreceiverv2.cpp b/libpyside/globalreceiverv2.cpp
index 65a37ee..ca72e3f 100644
--- a/libpyside/globalreceiverv2.cpp
+++ b/libpyside/globalreceiverv2.cpp
@@ -78,6 +78,8 @@ using namespace PySide;
DynamicSlotDataV2::DynamicSlotDataV2(PyObject* callback, GlobalReceiverV2* parent)
: m_pythonSelf(0), m_pyClass(0), m_weakRef(0), m_parent(parent)
{
+ Shiboken::GilState gil;
+
m_isMethod = PyMethod_Check(callback);
if (m_isMethod) {
//Can not store calback pointe because this will be destroyed at the end of the scope
@@ -271,6 +273,7 @@ const QMetaObject* GlobalReceiverV2::metaObject() const
int GlobalReceiverV2::qt_metacall(QMetaObject::Call call, int id, void** args)
{
+ Shiboken::GilState gil;
Q_ASSERT(call == QMetaObject::InvokeMetaMethod);
Q_ASSERT(id >= QObject::staticMetaObject.methodCount());