From 4c5cc426a4841657d25b70df4080c220ed16bb7c Mon Sep 17 00:00:00 2001 From: Pankaj Pandey Date: Sun, 29 Sep 2013 18:33:55 +0530 Subject: Fix PYSIDE-190 QCoreApplication would deadlock on exit if the global QThreadPool.globalInstance() is running a QRunnable with python code because the destroyQCoreApplication function would not release the the GIL which `delete`ing the QCoreApplication. Change-Id: I7b8a3bbd33f86050368a9357fa93e25a642b4ac5 Reviewed-by: John Ehresman --- libpyside/pyside.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index 4f26204b1..3d47b8691 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -151,7 +151,12 @@ void destroyQCoreApplication() bm.visitAllPyObjects(&destructionVisitor, &data); // in the end destroy app + // Allow threads because the destructor calls + // QThreadPool::globalInstance().waitForDone() which may deadlock on the GIL + // if there is a worker working with python objects. + Py_BEGIN_ALLOW_THREADS delete app; + Py_END_ALLOW_THREADS } struct TypeUserData { -- cgit v1.2.3