barbieri pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=b52a0151b7e729004f3cbcb0e3a2c31da6b52968
commit b52a0151b7e729004f3cbcb0e3a2c31da6b52968 Author: Gustavo Sverzut Barbieri <barbi...@profusion.mobi> Date: Tue Nov 22 21:56:41 2016 -0200 ecore_ipc_client_example: better lifecycle management. If the server is gone, immediately delete it, this exercises deleting the server from inside its event. Then, if the server was already deleted, do not do it again. Also remove the shadow variable, keep only the global scope. --- src/examples/ecore/ecore_ipc_client_example.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/examples/ecore/ecore_ipc_client_example.c b/src/examples/ecore/ecore_ipc_client_example.c index a6379a1..68ca537 100644 --- a/src/examples/ecore/ecore_ipc_client_example.c +++ b/src/examples/ecore/ecore_ipc_client_example.c @@ -15,8 +15,6 @@ _server_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) puts("INFO: start typing some lines of text to send to server..."); - server = ev->server; - return ECORE_CALLBACK_RENEW; } @@ -27,6 +25,7 @@ _server_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) printf("INFO: server deleted %p: %s\n", ev->server, ecore_ipc_server_ip_get(ev->server)); + ecore_ipc_server_del(server); server = NULL; ecore_main_loop_quit(); return ECORE_CALLBACK_RENEW; @@ -150,7 +149,6 @@ main(int argc, char **argv) ECORE_GETOPT_VALUE_NONE /* sentinel */ }; int args; - Ecore_Ipc_Server *server; Ecore_Event_Handler *handlers[3]; ecore_init(); @@ -209,8 +207,11 @@ main(int argc, char **argv) ecore_main_loop_begin(); - ecore_ipc_server_del(server); - server = NULL; + if (server) + { + ecore_ipc_server_del(server); + server = NULL; + } ecore_event_handler_del(handlers[0]); ecore_event_handler_del(handlers[1]); --