diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-06-02 14:37:22 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-06-03 11:10:18 +0000 |
| commit | 039776b1af905ab90ab49f6986214450e8099882 (patch) | |
| tree | 84e0934fd42c1f9382fdc24ca8348391b4528ad7 /sources/pyside6/PySide6/glue/qtgui.cpp | |
| parent | 243aa7128cffd957f088ed66d5056211b64d7771 (diff) | |
Fix error about not holding the GIL when releasing QImage memory
Fix: "Fatal Python error: Python memory allocator called without holding the GIL"
when running sources/pyside6/tests/QtWidgets/qimage_test.py
Acquire the GIL for releasing.
Amends a97698f0a5d011fd206db94cf73dba6353f39b29.
Pick-to: 6.1 5.15
Task-number: PYSIDE-1563
Change-Id: Idf8dbf857f6dde76f80a78f581dacb3cf5fea16b
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside6/PySide6/glue/qtgui.cpp')
| -rw-r--r-- | sources/pyside6/PySide6/glue/qtgui.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/glue/qtgui.cpp b/sources/pyside6/PySide6/glue/qtgui.cpp index 681539c97..ef5caa545 100644 --- a/sources/pyside6/PySide6/glue/qtgui.cpp +++ b/sources/pyside6/PySide6/glue/qtgui.cpp @@ -163,7 +163,10 @@ for (Py_ssize_t i = 0; i < count; ++i){ // @snippet qimage-decref-image-data static void imageDecrefDataHandler(void *data) { + // Avoid "Python memory allocator called without holding the GIL" + auto state = PyGILState_Ensure(); Py_DECREF(reinterpret_cast<PyObject *>(data)); + PyGILState_Release(state); } // @snippet qimage-decref-image-data |
