aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/glue/qtgui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/PySide6/glue/qtgui.cpp')
-rw-r--r--sources/pyside6/PySide6/glue/qtgui.cpp3
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