From 908c7a9f9135f982b3cbc232d45170e450682d39 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Mon, 22 Jun 2015 14:41:39 +0200 Subject: [PATCH 1/1] MSG_process_get_data(): don't segfault if there the process has been cleaned up --- src/msg/msg_process.c | 5 ++++- src/simix/smx_private.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/msg/msg_process.c b/src/msg/msg_process.c index c3038c7a86..44d3838ad8 100644 --- a/src/msg/msg_process.c +++ b/src/msg/msg_process.c @@ -239,7 +239,10 @@ void* MSG_process_get_data(msg_process_t process) /* get from SIMIX the MSG process data, and then the user data */ simdata_process_t simdata = simcall_process_get_data(process); - return simdata->data; + if (simdata) + return simdata->data; + else + return NULL; } /** \ingroup m_process_management diff --git a/src/simix/smx_private.h b/src/simix/smx_private.h index 60831b8b6a..9576a92e2b 100644 --- a/src/simix/smx_private.h +++ b/src/simix/smx_private.h @@ -47,6 +47,7 @@ typedef struct s_smx_global { xbt_dict_t registered_functions; smx_creation_func_t create_process_function; void_pfn_smxprocess_t_smxprocess_t kill_process_function; + /** Callback used when killing a SMX_process */ void_pfn_smxprocess_t cleanup_process_function; xbt_mallocator_t synchro_mallocator; void_pfn_smxhost_t autorestart; -- 2.20.1