aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken/gilstate.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-06-18 09:53:06 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-06-26 15:14:14 +0200
commit52f29458d7d6cb379d28d84021819516723d9169 (patch)
treeafad9317cbf204ff6716c24ec4041b4495bfd36d /sources/shiboken2/libshiboken/gilstate.cpp
parentb7e8b5e4114c034a750433d661b20944ce8b303c (diff)
pthreads: Try to abandon the GIL in case a thread was terminated
When terminating a thread using QThread::terminate() via (pthread_cancel(), QThread::run() is aborted and the lock is released, but ~GilState() is still executed for some reason. Add a cancel handler to the thread which tells GilState to abandon the lock. Fixes: PYSIDE-1282 Change-Id: I70abd42b5a2afd49aaa8cc5e8be0a92ed63f49d3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/libshiboken/gilstate.cpp')
-rw-r--r--sources/shiboken2/libshiboken/gilstate.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/sources/shiboken2/libshiboken/gilstate.cpp b/sources/shiboken2/libshiboken/gilstate.cpp
index a59c6f01e..76a4d0e61 100644
--- a/sources/shiboken2/libshiboken/gilstate.cpp
+++ b/sources/shiboken2/libshiboken/gilstate.cpp
@@ -63,5 +63,12 @@ void GilState::release()
}
}
+// Abandon the lock: Only for special situations, like termination of a
+// POSIX thread (PYSIDE 1282).
+void GilState::abandon()
+{
+ m_locked = false;
+}
+
} // namespace Shiboken