diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-03-10 13:05:59 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-03-10 18:40:09 +0100 |
| commit | cbb0b363ea272b452654b3dd918718e749448a2b (patch) | |
| tree | 4caf9606c609ae715c734e636f592fec85741ec7 /sources/pyside6/libpyside/pyside.cpp | |
| parent | dc818a2c2c4ee4481b8a05f03bef8b95dac31732 (diff) | |
Fix exit crash related to QObject::thread()
In the deletion handler registered by getWrapperForQObject(),
add a check whether Python is still initialized.
Fixes: PYSIDE-2254
Pick-to: 6.4
Change-Id: I20d221b57fc9d0aaa7ef4067a79fb0c3bb4ef844
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/pyside.cpp')
| -rw-r--r-- | sources/pyside6/libpyside/pyside.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sources/pyside6/libpyside/pyside.cpp b/sources/pyside6/libpyside/pyside.cpp index e92e0bfa4..42b7725cc 100644 --- a/sources/pyside6/libpyside/pyside.cpp +++ b/sources/pyside6/libpyside/pyside.cpp @@ -632,6 +632,11 @@ namespace PySide static void invalidatePtr(any_t *object) { + // PYSIDE-2254: Guard against QObjects outliving Python, for example the + // adopted main thread as returned by QObjects::thread(). + if (Py_IsInitialized() == 0) + return; + Shiboken::GilState state; SbkObject *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(object); |
