From 0a20806b1ace627bd8d63b12244310ab426b2eea Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 21 Mar 2019 05:32:17 +0800 Subject: [PATCH] fix sigint guard condition's lifecycle bug (#288) * fix https://github.com/ros2/rclpy/issues/215 Signed-off-by: reed-lau Signed-off-by: Shane Loretz --- rclpy/src/rclpy/_rclpy.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rclpy/src/rclpy/_rclpy.c b/rclpy/src/rclpy/_rclpy.c index 11320b841..1b7969d4f 100644 --- a/rclpy/src/rclpy/_rclpy.c +++ b/rclpy/src/rclpy/_rclpy.c @@ -2115,6 +2115,9 @@ rclpy_destroy_entity(PyObject * Py_UNUSED(self), PyObject * args) } else if (PyCapsule_IsValid(pyentity, "rcl_guard_condition_t")) { rcl_guard_condition_t * guard_condition = (rcl_guard_condition_t *)PyCapsule_GetPointer( pyentity, "rcl_guard_condition_t"); + if (g_sigint_gc_handle == guard_condition) { + g_sigint_gc_handle = NULL; + } ret = rcl_guard_condition_fini(guard_condition); PyMem_Free(guard_condition); } else {