aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPankaj Pandey <pankaj86@gmail.com>2013-09-29 18:33:55 +0530
committerJohn Ehresman <jpe@wingware.com>2014-04-15 23:24:40 +0200
commit4c5cc426a4841657d25b70df4080c220ed16bb7c (patch)
treec8e4d740f1f856653a562caf009195627f6bc1ab
parent10ce3bcbcdcb7e846c21c3f4055968a33124fd01 (diff)
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 <jpe@wingware.com>
-rw-r--r--libpyside/pyside.cpp5
1 files changed, 5 insertions, 0 deletions
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 {