davemds pushed a commit to branch master. http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=d87b3bb9d0f55e7e5b9b67261a039076c6ecf933
commit d87b3bb9d0f55e7e5b9b67261a039076c6ecf933 Author: Dave Andreoli <[email protected]> Date: Mon Aug 8 16:43:35 2016 +0200 dbus: cleanup timeouts now timeouts should be much more stable --- efl/dbus_mainloop/e_dbus.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/efl/dbus_mainloop/e_dbus.c b/efl/dbus_mainloop/e_dbus.c index 5b2771c..808e352 100644 --- a/efl/dbus_mainloop/e_dbus.c +++ b/efl/dbus_mainloop/e_dbus.c @@ -225,15 +225,13 @@ e_dbus_timeout_handler(void *data) { E_DBus_Timeout_Data *td = data; - if (!dbus_timeout_get_enabled(td->timeout)) - { - DBG("timeout_handler (not enabled, ending)"); - td->handler = NULL; - return ECORE_CALLBACK_CANCEL; - } + DBG("timeout expired!"); + + if (dbus_timeout_get_enabled(td->timeout)) + dbus_timeout_handle(td->timeout); - DBG("timeout handler!"); - dbus_timeout_handle(td->timeout); + td->cd->timeouts = eina_list_remove(td->cd->timeouts, td->handler); + td->handler = NULL; return ECORE_CALLBACK_CANCEL; } @@ -253,17 +251,21 @@ cb_timeout_add(DBusTimeout *timeout, void *data) E_DBus_Connection *cd = data; E_DBus_Timeout_Data *td; - DBG("timeout add!"); + DBG("timeout add! enabled: %d, interval: %d", + dbus_timeout_get_enabled(timeout), + dbus_timeout_get_interval(timeout)); + td = calloc(1, sizeof(E_DBus_Timeout_Data)); td->cd = cd; - dbus_timeout_set_data(timeout, (void *)td, e_dbus_timeout_data_free); - td->timeout = timeout; + dbus_timeout_set_data(timeout, (void *)td, e_dbus_timeout_data_free); if (dbus_timeout_get_enabled(timeout)) + { td->handler = ecore_timer_add(dbus_timeout_get_interval(timeout), e_dbus_timeout_handler, td); - td->cd->timeouts = eina_list_append(td->cd->timeouts, td->handler); + cd->timeouts = eina_list_append(cd->timeouts, td->handler); + } return true; } @@ -271,14 +273,14 @@ cb_timeout_add(DBusTimeout *timeout, void *data) static void cb_timeout_del(DBusTimeout *timeout, void *data) { - E_DBus_Timeout_Data *td; - DBG("timeout del!"); + E_DBus_Connection *cd = data; + E_DBus_Timeout_Data *td = dbus_timeout_get_data(timeout); - td = (E_DBus_Timeout_Data *)dbus_timeout_get_data(timeout); + DBG("timeout del!"); if (td->handler) { - td->cd->timeouts = eina_list_remove(td->cd->timeouts, td->handler); + cd->timeouts = eina_list_remove(cd->timeouts, td->handler); ecore_timer_del(td->handler); td->handler = NULL; } @@ -289,18 +291,19 @@ cb_timeout_del(DBusTimeout *timeout, void *data) static void cb_timeout_toggle(DBusTimeout *timeout, void *data) { - E_DBus_Timeout_Data *td; + E_DBus_Connection *cd = data; + E_DBus_Timeout_Data *td = dbus_timeout_get_data(timeout); DBG("timeout toggle!"); - td = (E_DBus_Timeout_Data *)dbus_timeout_get_data(timeout); - if (dbus_timeout_get_enabled(td->timeout)) { td->handler = ecore_timer_add(dbus_timeout_get_interval(timeout), e_dbus_timeout_handler, td); + cd->timeouts = eina_list_append(cd->timeouts, td->handler); } else { + cd->timeouts = eina_list_remove(cd->timeouts, td->handler); ecore_timer_del(td->handler); td->handler = NULL; } --
