aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/libpyside
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/libpyside')
-rw-r--r--sources/pyside2/libpyside/dynamicqmetaobject.cpp3
-rw-r--r--sources/pyside2/libpyside/signalmanager.cpp12
-rw-r--r--sources/pyside2/libpyside/signalmanager.h1
3 files changed, 14 insertions, 2 deletions
diff --git a/sources/pyside2/libpyside/dynamicqmetaobject.cpp b/sources/pyside2/libpyside/dynamicqmetaobject.cpp
index 51e6598b3..dae9e2059 100644
--- a/sources/pyside2/libpyside/dynamicqmetaobject.cpp
+++ b/sources/pyside2/libpyside/dynamicqmetaobject.cpp
@@ -140,7 +140,8 @@ MetaObjectBuilder::MetaObjectBuilder(PyTypeObject *type, const QMetaObject *meta
MetaObjectBuilder::~MetaObjectBuilder()
{
- qDeleteAll(m_d->m_cachedMetaObjects);
+ for (auto *metaObject : m_d->m_cachedMetaObjects)
+ free(const_cast<QMetaObject*>(metaObject));
delete m_d->m_builder;
delete m_d;
}
diff --git a/sources/pyside2/libpyside/signalmanager.cpp b/sources/pyside2/libpyside/signalmanager.cpp
index 01b347a3d..8e8cc9f02 100644
--- a/sources/pyside2/libpyside/signalmanager.cpp
+++ b/sources/pyside2/libpyside/signalmanager.cpp
@@ -114,18 +114,24 @@ namespace PySide {
PyObjectWrapper::PyObjectWrapper()
:m_me(Py_None)
{
+ // PYSIDE-813: When PYSIDE-164 was solved by adding some thread allowance,
+ // this code was no longer protected. It was hard to find this connection.
+ // See the website https://bugreports.qt.io/browse/PYSIDE-813 for details.
+ Shiboken::GilState gil;
Py_XINCREF(m_me);
}
PyObjectWrapper::PyObjectWrapper(PyObject *me)
: m_me(me)
{
+ Shiboken::GilState gil;
Py_XINCREF(m_me);
}
PyObjectWrapper::PyObjectWrapper(const PyObjectWrapper &other)
: m_me(other.m_me)
{
+ Shiboken::GilState gil;
Py_XINCREF(m_me);
}
@@ -142,6 +148,7 @@ PyObjectWrapper::~PyObjectWrapper()
void PyObjectWrapper::reset(PyObject *o)
{
+ Shiboken::GilState gil;
Py_XINCREF(o);
Py_XDECREF(m_me);
m_me = o;
@@ -559,7 +566,10 @@ static MetaObjectBuilder *metaBuilderFromDict(PyObject *dict)
if (!dict || !PyDict_Contains(dict, metaObjectAttr))
return nullptr;
- PyObject *pyBuilder = PyDict_GetItem(dict, metaObjectAttr);
+ // PYSIDE-813: The above assumption is not true in debug mode:
+ // PyDict_GetItem would touch PyThreadState_GET and the global error state.
+ // PyDict_GetItemWithError instead can work without GIL.
+ PyObject *pyBuilder = PyDict_GetItemWithError(dict, metaObjectAttr);
#ifdef IS_PY3K
return reinterpret_cast<MetaObjectBuilder *>(PyCapsule_GetPointer(pyBuilder, nullptr));
#else
diff --git a/sources/pyside2/libpyside/signalmanager.h b/sources/pyside2/libpyside/signalmanager.h
index 229ddb91d..fe077bd1a 100644
--- a/sources/pyside2/libpyside/signalmanager.h
+++ b/sources/pyside2/libpyside/signalmanager.h
@@ -43,6 +43,7 @@
#include "pysidemacros.h"
#include <sbkpython.h>
+#include <shibokenmacros.h>
#include <QtCore/QMetaMethod>