cedric pushed a commit to branch master.
commit 1db92f9ac07d4d38f9eb3b861cc2a176717a2a44
Author: Cedric Bail <[email protected]>
Date: Mon May 20 18:16:39 2013 +0900
eo: some event should not be frozen.
---
src/lib/eo/Eo.h | 17 ++++++++++++++++-
src/lib/eo/eo_base_class.c | 15 ++++++++++++---
2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index a1899f2..1e73d16 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -271,6 +271,8 @@ struct _Eo_Event_Description
{
const char *name; /**< name of the event. */
const char *doc; /**< Explanation about the event. */
+
+ Eina_Bool unfreezable; /**< Eina_True if the event cannot be frozen */
};
/**
@@ -286,7 +288,20 @@ typedef struct _Eo_Event_Description Eo_Event_Description;
* @param doc Additional doc for the event.
* @see Eo_Event_Description
*/
-#define EO_EVENT_DESCRIPTION(name, doc) { name, doc }
+#define EO_EVENT_DESCRIPTION(name, doc) { name, doc, EINA_FALSE }
+
+/**
+ * @def EO_HOT_EVENT_DESCRIPTION(name, doc)
+ * An helper macro to help populating #Eo_Event_Description and make
+ * the event impossible to freeze.
+ * @param name The name of the event.
+ * @param doc Additional doc for the event.
+ * @see Eo_Event_Description
+ * @see EO_EVENT_DESCRIPTION
+ */
+#define EO_HOT_EVENT_DESCRIPTION(name, doc) { name, doc, EINA_TRUE }
+
+
/**
* @}
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index 979e8a0..5f7da48 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -247,13 +247,16 @@ _wref_destruct(Private_Data *pd)
struct _Eo_Callback_Description
{
Eo_Callback_Description *next;
+
union
{
Eo_Callback_Array_Item item;
const Eo_Callback_Array_Item *item_array;
} items;
+
void *func_data;
Eo_Callback_Priority priority;
+
Eina_Bool delete_me : 1;
Eina_Bool func_array : 1;
};
@@ -452,9 +455,6 @@ _ev_cb_call(Eo *obj, void *class_data, va_list *list)
if (ret) *ret = EINA_TRUE;
- if (event_freeze_count || pd->event_freeze_count)
- return;
-
/* FIXME: Change eo_ref to _eo_ref and unref. */
eo_ref(obj);
pd->walking_list++;
@@ -471,6 +471,10 @@ _ev_cb_call(Eo *obj, void *class_data, va_list *list)
{
if (it->desc != desc)
continue;
+ if (!it->desc->unfreezable &&
+ (event_freeze_count || pd->event_freeze_count))
+ continue;
+
/* Abort callback calling if the func says so. */
if (!it->func((void *) cb->func_data, obj, desc,
(void *) event_info))
@@ -482,6 +486,11 @@ _ev_cb_call(Eo *obj, void *class_data, va_list *list)
}
else
{
+ if ((!cb->items.item.desc
+ || !cb->items.item.desc->unfreezable) &&
+ (event_freeze_count || pd->event_freeze_count))
+ continue;
+
if (cb->items.item.desc == desc)
{
/* Abort callback calling if the func says so. */
--
------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d