From ff24ac2d6ddaafba49ae5100f17fe37e5d874140 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 19 Dec 2017 11:14:37 +0900 Subject: efl: Reset ecore event types on init This fixes cycles of init/shutdown/init where ecore event types would become invalid, since they are now stored in a dynamic array rather than a statically stored array. The risk here is that if a module of EFL tends to init/shutdown in a "normal" scenario then the event type array will grow in a leaking manner. This could be fixed by resetting those event ID's only when the loop actually exits (EFL_EVENT_DEL on the main loop). I'm not using EFL_EVENT_DEL in this patch as this would add too many event callbacks to the main loop object, which may result in slightly slower event calls to it, affecting the overall performance. --- src/lib/elocation/elocation.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'src/lib/elocation') diff --git a/src/lib/elocation/elocation.c b/src/lib/elocation/elocation.c index 0edf925480..cb0431c1ab 100644 --- a/src/lib/elocation/elocation.c +++ b/src/lib/elocation/elocation.c @@ -1253,21 +1253,18 @@ elocation_init(void) } /* Create all ecore event types we send out to interested applications */ - if (ELOCATION_EVENT_IN == 0) - { - ELOCATION_EVENT_IN = ecore_event_type_new(); - ELOCATION_EVENT_OUT = ecore_event_type_new(); - ELOCATION_EVENT_STATUS = ecore_event_type_new(); - ELOCATION_EVENT_POSITION = ecore_event_type_new(); - ELOCATION_EVENT_ADDRESS = ecore_event_type_new(); - ELOCATION_EVENT_VELOCITY = ecore_event_type_new(); - ELOCATION_EVENT_GEOCODE = ecore_event_type_new(); - ELOCATION_EVENT_REVERSEGEOCODE = ecore_event_type_new(); - ELOCATION_EVENT_NMEA = ecore_event_type_new(); - ELOCATION_EVENT_SATELLITE = ecore_event_type_new(); - ELOCATION_EVENT_POI = ecore_event_type_new(); - ELOCATION_EVENT_META_READY = ecore_event_type_new(); - } + ELOCATION_EVENT_IN = ecore_event_type_new(); + ELOCATION_EVENT_OUT = ecore_event_type_new(); + ELOCATION_EVENT_STATUS = ecore_event_type_new(); + ELOCATION_EVENT_POSITION = ecore_event_type_new(); + ELOCATION_EVENT_ADDRESS = ecore_event_type_new(); + ELOCATION_EVENT_VELOCITY = ecore_event_type_new(); + ELOCATION_EVENT_GEOCODE = ecore_event_type_new(); + ELOCATION_EVENT_REVERSEGEOCODE = ecore_event_type_new(); + ELOCATION_EVENT_NMEA = ecore_event_type_new(); + ELOCATION_EVENT_SATELLITE = ecore_event_type_new(); + ELOCATION_EVENT_POI = ecore_event_type_new(); + ELOCATION_EVENT_META_READY = ecore_event_type_new(); obj_master= eldbus_object_get(conn, GEOCLUE_DBUS_NAME, GEOCLUE_OBJECT_PATH); if (!obj_master) -- cgit v1.2.1