From a6857b4ec7b58a28acc431e39795891c9aeb88ac Mon Sep 17 00:00:00 2001 From: Alexander Afanasyev Date: Tue, 13 Aug 2013 22:56:39 -0700 Subject: [PATCH] bug 1754: add missing GIL lock in generated callback destructor --- bindings/python/ns3modulegen_core_customizations.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bindings/python/ns3modulegen_core_customizations.py b/bindings/python/ns3modulegen_core_customizations.py index 218cae556..c9dedc699 100644 --- a/bindings/python/ns3modulegen_core_customizations.py +++ b/bindings/python/ns3modulegen_core_customizations.py @@ -177,8 +177,11 @@ public: } virtual ~%s() { + PyGILState_STATE __py_gil_state; + __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0); Py_DECREF(m_callback); m_callback = NULL; + PyGILState_Release(__py_gil_state); } virtual bool IsEqual(ns3::Ptr other_base) const