aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/pyside.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/libpyside/pyside.cpp')
-rw-r--r--sources/pyside6/libpyside/pyside.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/sources/pyside6/libpyside/pyside.cpp b/sources/pyside6/libpyside/pyside.cpp
index 2026fee53..af181810a 100644
--- a/sources/pyside6/libpyside/pyside.cpp
+++ b/sources/pyside6/libpyside/pyside.cpp
@@ -68,6 +68,7 @@
#include <QtCore/QFileInfo>
#include <QtCore/QSharedPointer>
#include <QtCore/QStack>
+#include <QtCore/QThread>
#include <algorithm>
#include <cstring>
@@ -463,8 +464,10 @@ PyObject *getWrapperForQObject(QObject *cppSelf, SbkObjectType *sbk_type)
// set and check if it's created after the set call
QVariant existing = cppSelf->property(invalidatePropertyName);
if (!existing.isValid()) {
- QSharedPointer<any_t> shared_with_del(reinterpret_cast<any_t *>(cppSelf), invalidatePtr);
- cppSelf->setProperty(invalidatePropertyName, QVariant::fromValue(shared_with_del));
+ if (cppSelf->thread() == QThread::currentThread()) {
+ QSharedPointer<any_t> shared_with_del(reinterpret_cast<any_t *>(cppSelf), invalidatePtr);
+ cppSelf->setProperty(invalidatePropertyName, QVariant::fromValue(shared_with_del));
+ }
pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(cppSelf));
if (pyOut) {
Py_INCREF(pyOut);