eldbus: send exit/quit event upon disconnecting the session bus
authorMike Blumenkrantz <zmike@osg.samsung.com>
Fri, 6 May 2016 19:32:58 +0000 (15:32 -0400)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Fri, 6 May 2016 19:41:38 +0000 (15:41 -0400)
if an application is connected to the session bus, being disconnected
should indicate that the session has been terminated and all applications
in that session should also be terminated

this ensures that no zombie processes will remain after the session bus dies

src/lib/eldbus/eldbus_core.c

index f5bfc4a..df3aab6 100644 (file)
@@ -979,8 +979,17 @@ static void
 _disconnected(void *data, const Eldbus_Message *msg EINA_UNUSED)
 {
    Eldbus_Connection *conn = data;
+   Ecore_Event_Signal_Exit *ev;
+
    _eldbus_connection_event_callback_call(
       conn, ELDBUS_CONNECTION_EVENT_DISCONNECTED, NULL);
+   if (conn->type != ELDBUS_CONNECTION_TYPE_SESSION) return;
+
+   ev = calloc(1, sizeof(Ecore_Event_Signal_Exit));
+   if (!ev) return;
+
+   ev->quit = EINA_TRUE;
+   ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, ev, NULL, NULL);
 }
 
 /* Param address is only used for ELDBUS_CONNECTION_TYPE_ADDRESS type */