Need to acquire the Python GIL also in ~PythonEventImpl, as it may be called at any time from the C++ code, from any thread.
1.1 --- a/bindings/python/ns3module_helpers.cc Sat Sep 27 15:26:27 2008 +0100
1.2 +++ b/bindings/python/ns3module_helpers.cc Sat Sep 27 15:32:04 2008 +0100
1.3 @@ -28,8 +28,14 @@
1.4 }
1.5 virtual ~PythonEventImpl ()
1.6 {
1.7 + PyGILState_STATE __py_gil_state;
1.8 + __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
1.9 +
1.10 Py_DECREF(m_callback);
1.11 Py_DECREF(m_args);
1.12 +
1.13 + if (PyEval_ThreadsInitialized())
1.14 + PyGILState_Release(__py_gil_state);
1.15 }
1.16 virtual void Notify ()
1.17 {