From d2acdcdc1b4980e00e962aa809915ae95b944c0b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 28 Aug 2014 17:04:19 +0200 Subject: [PATCH] Prevent crash in the Python wrapper when destroying the cores. --- tools/python/apixml2python/handwritten_definitions.mustache | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/python/apixml2python/handwritten_definitions.mustache b/tools/python/apixml2python/handwritten_definitions.mustache index 2c1c308b0..4aab9c78d 100644 --- a/tools/python/apixml2python/handwritten_definitions.mustache +++ b/tools/python/apixml2python/handwritten_definitions.mustache @@ -14,6 +14,7 @@ static void pylinphone_log(const char *level, int indent, const char *fmt, va_li PyGILState_STATE gstate; gstate = PyGILState_Ensure(); + if (gstate != PyGILState_LOCKED) return; linphone_module = PyImport_ImportModule("linphone.linphone"); if ((linphone_module != NULL) && PyObject_HasAttrString(linphone_module, "__log_handler")) { PyObject *log_handler = PyObject_GetAttrString(linphone_module, "__log_handler"); @@ -71,6 +72,7 @@ static void pylinphone_module_log_handler(OrtpLogLevel lev, const char *fmt, va_ const char *level; gstate = PyGILState_Ensure(); + if (gstate != PyGILState_LOCKED) return; linphone_module = PyImport_ImportModule("linphone.linphone"); level = pylinphone_ortp_log_level_to_string(lev); if ((linphone_module != NULL) && PyObject_HasAttrString(linphone_module, "__log_handler")) {