2009-01-31 10:33:39 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2012-11-18 22:26:48 -08:00
|
|
|
#include <Eo.h>
|
|
|
|
|
2004-03-16 21:44:17 -08:00
|
|
|
#include "Ecore.h"
|
2009-12-22 13:15:12 -08:00
|
|
|
#include "ecore_private.h"
|
2004-03-16 21:44:17 -08:00
|
|
|
|
2012-10-10 01:19:58 -07:00
|
|
|
#define MY_CLASS ECORE_IDLE_EXITER_CLASS
|
|
|
|
|
2013-11-07 03:16:01 -08:00
|
|
|
#define MY_CLASS_NAME "Ecore_Idle_Exiter"
|
2012-10-10 01:19:58 -07:00
|
|
|
|
2014-03-24 01:29:39 -07:00
|
|
|
struct _Ecore_Idle_Exiter_Data
|
2011-12-11 00:29:35 -08:00
|
|
|
{
|
|
|
|
EINA_INLIST;
|
2012-10-10 01:19:58 -07:00
|
|
|
Ecore_Idle_Exiter *obj;
|
|
|
|
Ecore_Task_Cb func;
|
|
|
|
void *data;
|
|
|
|
int references;
|
|
|
|
Eina_Bool delete_me : 1;
|
2011-12-11 00:29:35 -08:00
|
|
|
};
|
|
|
|
|
2014-03-24 01:29:39 -07:00
|
|
|
typedef struct _Ecore_Idle_Exiter_Data Ecore_Idle_Exiter_Data;
|
2012-10-10 01:19:58 -07:00
|
|
|
|
2014-03-24 01:29:39 -07:00
|
|
|
static Ecore_Idle_Exiter_Data *idle_exiters = NULL;
|
|
|
|
static Ecore_Idle_Exiter_Data *idle_exiter_current = NULL;
|
2011-10-20 22:40:39 -07:00
|
|
|
static int idle_exiters_delete_me = 0;
|
2004-03-16 21:44:17 -08:00
|
|
|
|
2011-07-28 05:01:16 -07:00
|
|
|
static void *
|
|
|
|
_ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter);
|
|
|
|
|
2010-10-17 00:03:28 -07:00
|
|
|
/**
|
2011-08-10 12:14:48 -07:00
|
|
|
* @addtogroup Ecore_Idle_Group
|
2010-10-17 00:03:28 -07:00
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2004-03-16 21:44:17 -08:00
|
|
|
/**
|
|
|
|
* Add an idle exiter handler.
|
|
|
|
* @param func The function to call when exiting an idle state.
|
|
|
|
* @param data The data to be passed to the @p func call
|
2004-05-07 21:44:04 -07:00
|
|
|
* @return A handle to the idle exiter callback on success. NULL otherwise.
|
2011-06-22 11:29:38 -07:00
|
|
|
* @note The function func will be called every time the main loop is exiting
|
|
|
|
* idle state, as long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0
|
|
|
|
* (or ECORE_CALLBACK_CANCEL) deletes the idle exiter.
|
2004-03-16 21:44:17 -08:00
|
|
|
*/
|
2006-01-06 09:58:12 -08:00
|
|
|
EAPI Ecore_Idle_Exiter *
|
2011-10-20 22:40:39 -07:00
|
|
|
ecore_idle_exiter_add(Ecore_Task_Cb func,
|
|
|
|
const void *data)
|
2004-03-16 21:44:17 -08:00
|
|
|
{
|
2011-07-28 05:01:16 -07:00
|
|
|
Ecore_Idle_Exiter *ie = NULL;
|
2012-10-10 01:19:58 -07:00
|
|
|
ie = eo_add_custom(MY_CLASS, _ecore_parent, ecore_idle_exiter_constructor(func, data));
|
|
|
|
eo_unref(ie);
|
|
|
|
return ie;
|
|
|
|
}
|
|
|
|
|
2014-03-24 01:29:39 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_ecore_idle_exiter_constructor(Eo *obj, Ecore_Idle_Exiter_Data *ie, Ecore_Task_Cb func, const void *data)
|
2012-10-10 01:19:58 -07:00
|
|
|
{
|
2011-07-28 05:01:16 -07:00
|
|
|
_ecore_lock();
|
2012-10-10 01:19:58 -07:00
|
|
|
if (EINA_UNLIKELY(!eina_main_loop_is()))
|
|
|
|
{
|
|
|
|
eo_error_set(obj);
|
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ie->obj = obj;
|
2013-03-18 08:33:54 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, eo_constructor());
|
2012-10-10 01:19:58 -07:00
|
|
|
eo_manual_free_set(obj, EINA_TRUE);
|
|
|
|
|
|
|
|
if (!func)
|
|
|
|
{
|
|
|
|
eo_error_set(obj);
|
|
|
|
ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-03-16 21:44:17 -08:00
|
|
|
ie->func = func;
|
|
|
|
ie->data = (void *)data;
|
2012-10-10 01:19:58 -07:00
|
|
|
|
2014-03-24 01:29:39 -07:00
|
|
|
idle_exiters = (Ecore_Idle_Exiter_Data *)eina_inlist_append(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
2011-07-28 05:01:16 -07:00
|
|
|
_ecore_unlock();
|
2012-10-10 01:19:58 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 01:29:39 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_ecore_idle_exiter_eo_base_constructor(Eo *obj, Ecore_Idle_Exiter_Data *_pd EINA_UNUSED)
|
2012-10-10 01:19:58 -07:00
|
|
|
{
|
|
|
|
eo_error_set(obj);
|
|
|
|
ERR("only custom constructor can be used with '%s' class", MY_CLASS_NAME);
|
2004-03-16 21:44:17 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2004-05-07 21:44:04 -07:00
|
|
|
* Delete an idle exiter handler from the list to be run on exiting idle state.
|
2004-03-16 21:44:17 -08:00
|
|
|
* @param idle_exiter The idle exiter to delete
|
2004-05-07 21:44:04 -07:00
|
|
|
* @return The data pointer that was being being passed to the handler if
|
|
|
|
* successful. NULL otherwise.
|
2004-03-16 21:44:17 -08:00
|
|
|
*/
|
2006-01-06 09:58:12 -08:00
|
|
|
EAPI void *
|
2004-03-16 21:44:17 -08:00
|
|
|
ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter)
|
|
|
|
{
|
2011-07-28 05:01:16 -07:00
|
|
|
void *data;
|
2011-07-05 04:13:29 -07:00
|
|
|
|
2012-12-24 01:35:56 -08:00
|
|
|
if (!idle_exiter) return NULL;
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2012-10-10 01:19:58 -07:00
|
|
|
|
2011-07-28 05:01:16 -07:00
|
|
|
_ecore_lock();
|
|
|
|
data = _ecore_idle_exiter_del(idle_exiter);
|
|
|
|
_ecore_unlock();
|
|
|
|
return data;
|
2004-03-16 21:44:17 -08:00
|
|
|
}
|
|
|
|
|
2010-10-17 00:03:28 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2011-07-28 05:01:16 -07:00
|
|
|
static void *
|
2012-10-10 01:19:58 -07:00
|
|
|
_ecore_idle_exiter_del(Ecore_Idle_Exiter *obj)
|
2011-07-28 05:01:16 -07:00
|
|
|
{
|
2014-03-24 01:29:39 -07:00
|
|
|
Ecore_Idle_Exiter_Data *idle_exiter = eo_data_scope_get(obj, MY_CLASS);
|
2011-07-28 05:01:16 -07:00
|
|
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(idle_exiter->delete_me, NULL);
|
|
|
|
idle_exiter->delete_me = 1;
|
|
|
|
idle_exiters_delete_me = 1;
|
|
|
|
return idle_exiter->data;
|
|
|
|
}
|
|
|
|
|
2012-10-10 01:19:58 -07:00
|
|
|
|
2014-03-24 01:29:39 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_ecore_idle_exiter_eo_base_destructor(Eo *obj, Ecore_Idle_Exiter_Data *idle_exiter)
|
2012-10-10 01:19:58 -07:00
|
|
|
{
|
|
|
|
|
|
|
|
idle_exiter->delete_me = 1;
|
|
|
|
idle_exiters_delete_me = 1;
|
|
|
|
|
2013-03-18 08:33:54 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, eo_destructor());
|
2012-10-10 01:19:58 -07:00
|
|
|
}
|
|
|
|
|
2004-03-16 21:44:17 -08:00
|
|
|
void
|
|
|
|
_ecore_idle_exiter_shutdown(void)
|
|
|
|
{
|
2014-03-24 01:29:39 -07:00
|
|
|
Ecore_Idle_Exiter_Data *ie;
|
2009-06-17 04:39:37 -07:00
|
|
|
while ((ie = idle_exiters))
|
2004-03-16 21:44:17 -08:00
|
|
|
{
|
2014-03-24 01:29:39 -07:00
|
|
|
idle_exiters = (Ecore_Idle_Exiter_Data *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters));
|
2012-10-10 01:19:58 -07:00
|
|
|
|
2013-09-24 21:32:41 -07:00
|
|
|
eo_do(ie->obj, eo_parent_set(NULL));
|
2012-10-10 01:19:58 -07:00
|
|
|
if (eo_destructed_is(ie->obj))
|
|
|
|
eo_manual_free(ie->obj);
|
|
|
|
else
|
|
|
|
eo_manual_free_set(ie->obj, EINA_FALSE);
|
2004-03-16 21:44:17 -08:00
|
|
|
}
|
|
|
|
idle_exiters_delete_me = 0;
|
Fix idle_exiters when using recursive main loops.
If an idle_exiter created a recursive main loop (just called
ecore_main_loop_begin()), then this recursive main loop should
continue to process idle_exiters from there and on, thus
idle_exiter_current was added. When going back from recursion, the
current iterator should be updated properly.
This patch also fixes the deletion of idle_exiters from recursive
main loops by reference counting them. This way, the node will not be
free()d inside inner loop cleanups and then crash when going back to
outer loop.
The following test case used to crash but not anymore:
#include <Ecore.h>
#include <Eina.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
static Ecore_Idle_Exiter *handle;
static int idler(void *data)
{
INF("idler");
return 1;
}
static int timer(void *data)
{
INF("timer (exited idle!)");
return 0;
}
static int exit_idle(void *data)
{
INF("add request (timer) to exit idle");
ecore_timer_add(0.0, timer, NULL);
return 0;
}
static int cb2(void *data)
{
INF("cb2 - delete cb1 handle");
ecore_idle_exiter_del(handle);
ecore_main_loop_quit(); /* quits inner main loop */
return 0;
}
static int cb1(void *data)
{
INF("cb1: begin");
INF(" add cb2");
ecore_idle_exiter_add(cb2, NULL);
INF(" add exit idler");
ecore_idler_add(exit_idle, NULL);
INF(" inner main loop begin (recurse)");
ecore_main_loop_begin(); /* will it crash due ecore_idle_exiter_del(handle)
* inside cb2()? It used to!
*/
INF("cb1: end");
ecore_main_loop_quit(); /* quits outer main loop */
return 0;
}
int main(void)
{
ecore_init();
_log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
/*
* Creating a new main loop from inside an idle_exiter callback,
* and inside this new (inner) main loop deleting the caller
* callback used to crash since the handle would be effectively
* free()d, but when the recursion is over the pointer would be
* used.
*/
INF("main: begin");
handle = ecore_idle_exiter_add(cb1, NULL);
ecore_idler_add(idler, NULL);
ecore_idler_add(exit_idle, NULL);
ecore_main_loop_begin();
INF("main: end");
return 0;
}
SVN revision: 46410
2010-02-23 14:25:35 -08:00
|
|
|
idle_exiter_current = NULL;
|
2004-03-16 21:44:17 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_idle_exiter_call(void)
|
|
|
|
{
|
Fix idle_exiters when using recursive main loops.
If an idle_exiter created a recursive main loop (just called
ecore_main_loop_begin()), then this recursive main loop should
continue to process idle_exiters from there and on, thus
idle_exiter_current was added. When going back from recursion, the
current iterator should be updated properly.
This patch also fixes the deletion of idle_exiters from recursive
main loops by reference counting them. This way, the node will not be
free()d inside inner loop cleanups and then crash when going back to
outer loop.
The following test case used to crash but not anymore:
#include <Ecore.h>
#include <Eina.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
static Ecore_Idle_Exiter *handle;
static int idler(void *data)
{
INF("idler");
return 1;
}
static int timer(void *data)
{
INF("timer (exited idle!)");
return 0;
}
static int exit_idle(void *data)
{
INF("add request (timer) to exit idle");
ecore_timer_add(0.0, timer, NULL);
return 0;
}
static int cb2(void *data)
{
INF("cb2 - delete cb1 handle");
ecore_idle_exiter_del(handle);
ecore_main_loop_quit(); /* quits inner main loop */
return 0;
}
static int cb1(void *data)
{
INF("cb1: begin");
INF(" add cb2");
ecore_idle_exiter_add(cb2, NULL);
INF(" add exit idler");
ecore_idler_add(exit_idle, NULL);
INF(" inner main loop begin (recurse)");
ecore_main_loop_begin(); /* will it crash due ecore_idle_exiter_del(handle)
* inside cb2()? It used to!
*/
INF("cb1: end");
ecore_main_loop_quit(); /* quits outer main loop */
return 0;
}
int main(void)
{
ecore_init();
_log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
/*
* Creating a new main loop from inside an idle_exiter callback,
* and inside this new (inner) main loop deleting the caller
* callback used to crash since the handle would be effectively
* free()d, but when the recursion is over the pointer would be
* used.
*/
INF("main: begin");
handle = ecore_idle_exiter_add(cb1, NULL);
ecore_idler_add(idler, NULL);
ecore_idler_add(exit_idle, NULL);
ecore_main_loop_begin();
INF("main: end");
return 0;
}
SVN revision: 46410
2010-02-23 14:25:35 -08:00
|
|
|
if (!idle_exiter_current)
|
|
|
|
{
|
2010-09-29 23:09:20 -07:00
|
|
|
/* regular main loop, start from head */
|
2011-10-20 22:40:39 -07:00
|
|
|
idle_exiter_current = idle_exiters;
|
Fix idle_exiters when using recursive main loops.
If an idle_exiter created a recursive main loop (just called
ecore_main_loop_begin()), then this recursive main loop should
continue to process idle_exiters from there and on, thus
idle_exiter_current was added. When going back from recursion, the
current iterator should be updated properly.
This patch also fixes the deletion of idle_exiters from recursive
main loops by reference counting them. This way, the node will not be
free()d inside inner loop cleanups and then crash when going back to
outer loop.
The following test case used to crash but not anymore:
#include <Ecore.h>
#include <Eina.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
static Ecore_Idle_Exiter *handle;
static int idler(void *data)
{
INF("idler");
return 1;
}
static int timer(void *data)
{
INF("timer (exited idle!)");
return 0;
}
static int exit_idle(void *data)
{
INF("add request (timer) to exit idle");
ecore_timer_add(0.0, timer, NULL);
return 0;
}
static int cb2(void *data)
{
INF("cb2 - delete cb1 handle");
ecore_idle_exiter_del(handle);
ecore_main_loop_quit(); /* quits inner main loop */
return 0;
}
static int cb1(void *data)
{
INF("cb1: begin");
INF(" add cb2");
ecore_idle_exiter_add(cb2, NULL);
INF(" add exit idler");
ecore_idler_add(exit_idle, NULL);
INF(" inner main loop begin (recurse)");
ecore_main_loop_begin(); /* will it crash due ecore_idle_exiter_del(handle)
* inside cb2()? It used to!
*/
INF("cb1: end");
ecore_main_loop_quit(); /* quits outer main loop */
return 0;
}
int main(void)
{
ecore_init();
_log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
/*
* Creating a new main loop from inside an idle_exiter callback,
* and inside this new (inner) main loop deleting the caller
* callback used to crash since the handle would be effectively
* free()d, but when the recursion is over the pointer would be
* used.
*/
INF("main: begin");
handle = ecore_idle_exiter_add(cb1, NULL);
ecore_idler_add(idler, NULL);
ecore_idler_add(exit_idle, NULL);
ecore_main_loop_begin();
INF("main: end");
return 0;
}
SVN revision: 46410
2010-02-23 14:25:35 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-29 23:09:20 -07:00
|
|
|
/* recursive main loop, continue from where we were */
|
2011-10-20 22:40:39 -07:00
|
|
|
idle_exiter_current =
|
2014-03-24 01:29:39 -07:00
|
|
|
(Ecore_Idle_Exiter_Data *)EINA_INLIST_GET(idle_exiter_current)->next;
|
Fix idle_exiters when using recursive main loops.
If an idle_exiter created a recursive main loop (just called
ecore_main_loop_begin()), then this recursive main loop should
continue to process idle_exiters from there and on, thus
idle_exiter_current was added. When going back from recursion, the
current iterator should be updated properly.
This patch also fixes the deletion of idle_exiters from recursive
main loops by reference counting them. This way, the node will not be
free()d inside inner loop cleanups and then crash when going back to
outer loop.
The following test case used to crash but not anymore:
#include <Ecore.h>
#include <Eina.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
static Ecore_Idle_Exiter *handle;
static int idler(void *data)
{
INF("idler");
return 1;
}
static int timer(void *data)
{
INF("timer (exited idle!)");
return 0;
}
static int exit_idle(void *data)
{
INF("add request (timer) to exit idle");
ecore_timer_add(0.0, timer, NULL);
return 0;
}
static int cb2(void *data)
{
INF("cb2 - delete cb1 handle");
ecore_idle_exiter_del(handle);
ecore_main_loop_quit(); /* quits inner main loop */
return 0;
}
static int cb1(void *data)
{
INF("cb1: begin");
INF(" add cb2");
ecore_idle_exiter_add(cb2, NULL);
INF(" add exit idler");
ecore_idler_add(exit_idle, NULL);
INF(" inner main loop begin (recurse)");
ecore_main_loop_begin(); /* will it crash due ecore_idle_exiter_del(handle)
* inside cb2()? It used to!
*/
INF("cb1: end");
ecore_main_loop_quit(); /* quits outer main loop */
return 0;
}
int main(void)
{
ecore_init();
_log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
/*
* Creating a new main loop from inside an idle_exiter callback,
* and inside this new (inner) main loop deleting the caller
* callback used to crash since the handle would be effectively
* free()d, but when the recursion is over the pointer would be
* used.
*/
INF("main: begin");
handle = ecore_idle_exiter_add(cb1, NULL);
ecore_idler_add(idler, NULL);
ecore_idler_add(exit_idle, NULL);
ecore_main_loop_begin();
INF("main: end");
return 0;
}
SVN revision: 46410
2010-02-23 14:25:35 -08:00
|
|
|
}
|
2008-11-29 03:23:17 -08:00
|
|
|
|
Fix idle_exiters when using recursive main loops.
If an idle_exiter created a recursive main loop (just called
ecore_main_loop_begin()), then this recursive main loop should
continue to process idle_exiters from there and on, thus
idle_exiter_current was added. When going back from recursion, the
current iterator should be updated properly.
This patch also fixes the deletion of idle_exiters from recursive
main loops by reference counting them. This way, the node will not be
free()d inside inner loop cleanups and then crash when going back to
outer loop.
The following test case used to crash but not anymore:
#include <Ecore.h>
#include <Eina.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
static Ecore_Idle_Exiter *handle;
static int idler(void *data)
{
INF("idler");
return 1;
}
static int timer(void *data)
{
INF("timer (exited idle!)");
return 0;
}
static int exit_idle(void *data)
{
INF("add request (timer) to exit idle");
ecore_timer_add(0.0, timer, NULL);
return 0;
}
static int cb2(void *data)
{
INF("cb2 - delete cb1 handle");
ecore_idle_exiter_del(handle);
ecore_main_loop_quit(); /* quits inner main loop */
return 0;
}
static int cb1(void *data)
{
INF("cb1: begin");
INF(" add cb2");
ecore_idle_exiter_add(cb2, NULL);
INF(" add exit idler");
ecore_idler_add(exit_idle, NULL);
INF(" inner main loop begin (recurse)");
ecore_main_loop_begin(); /* will it crash due ecore_idle_exiter_del(handle)
* inside cb2()? It used to!
*/
INF("cb1: end");
ecore_main_loop_quit(); /* quits outer main loop */
return 0;
}
int main(void)
{
ecore_init();
_log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
/*
* Creating a new main loop from inside an idle_exiter callback,
* and inside this new (inner) main loop deleting the caller
* callback used to crash since the handle would be effectively
* free()d, but when the recursion is over the pointer would be
* used.
*/
INF("main: begin");
handle = ecore_idle_exiter_add(cb1, NULL);
ecore_idler_add(idler, NULL);
ecore_idler_add(exit_idle, NULL);
ecore_main_loop_begin();
INF("main: end");
return 0;
}
SVN revision: 46410
2010-02-23 14:25:35 -08:00
|
|
|
while (idle_exiter_current)
|
2004-03-16 21:44:17 -08:00
|
|
|
{
|
2014-03-24 01:29:39 -07:00
|
|
|
Ecore_Idle_Exiter_Data *ie = (Ecore_Idle_Exiter_Data *)idle_exiter_current;
|
2010-09-29 23:09:20 -07:00
|
|
|
if (!ie->delete_me)
|
|
|
|
{
|
|
|
|
ie->references++;
|
2011-08-11 03:59:48 -07:00
|
|
|
if (!_ecore_call_task_cb(ie->func, ie->data))
|
2010-09-29 23:09:20 -07:00
|
|
|
{
|
2012-10-10 01:19:58 -07:00
|
|
|
if (!ie->delete_me) _ecore_idle_exiter_del(ie->obj);
|
2010-09-29 23:09:20 -07:00
|
|
|
}
|
|
|
|
ie->references--;
|
|
|
|
}
|
|
|
|
if (idle_exiter_current) /* may have changed in recursive main loops */
|
|
|
|
idle_exiter_current =
|
2014-03-24 01:29:39 -07:00
|
|
|
(Ecore_Idle_Exiter_Data *)EINA_INLIST_GET(idle_exiter_current)->next;
|
2004-03-16 21:44:17 -08:00
|
|
|
}
|
|
|
|
if (idle_exiters_delete_me)
|
|
|
|
{
|
2014-03-24 01:29:39 -07:00
|
|
|
Ecore_Idle_Exiter_Data *l;
|
2010-09-29 23:09:20 -07:00
|
|
|
int deleted_idler_exiters_in_use = 0;
|
|
|
|
|
2011-10-20 22:40:39 -07:00
|
|
|
for (l = idle_exiters; l; )
|
2010-09-29 23:09:20 -07:00
|
|
|
{
|
2014-03-24 01:29:39 -07:00
|
|
|
Ecore_Idle_Exiter_Data *ie = l;
|
2010-09-29 23:09:20 -07:00
|
|
|
|
2014-03-24 01:29:39 -07:00
|
|
|
l = (Ecore_Idle_Exiter_Data *)EINA_INLIST_GET(l)->next;
|
2010-09-29 23:09:20 -07:00
|
|
|
if (ie->delete_me)
|
|
|
|
{
|
|
|
|
if (ie->references)
|
|
|
|
{
|
|
|
|
deleted_idler_exiters_in_use++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-03-24 01:29:39 -07:00
|
|
|
idle_exiters = (Ecore_Idle_Exiter_Data *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
2012-10-10 01:19:58 -07:00
|
|
|
|
2013-09-24 21:32:41 -07:00
|
|
|
eo_do(ie->obj, eo_parent_set(NULL));
|
2012-10-10 01:19:58 -07:00
|
|
|
if (eo_destructed_is(ie->obj))
|
|
|
|
eo_manual_free(ie->obj);
|
|
|
|
else
|
|
|
|
eo_manual_free_set(ie->obj, EINA_FALSE);
|
2010-09-29 23:09:20 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!deleted_idler_exiters_in_use)
|
|
|
|
idle_exiters_delete_me = 0;
|
2004-03-16 21:44:17 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_ecore_idle_exiter_exist(void)
|
|
|
|
{
|
|
|
|
if (idle_exiters) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
2011-10-20 22:40:39 -07:00
|
|
|
|
2014-03-24 01:29:39 -07:00
|
|
|
#include "ecore_idle_exiter.eo.c"
|