raster pushed a commit to branch master.
commit a65f857cca5c7bdd0966f7f99a5238a5850d0234
Author: Youngbok Shin <[email protected]>
Date: Thu May 16 18:10:13 2013 +0900
entry: elm_entry_markup_filter_remove() has a problem when internally
defined filters are used. fixed.
When we call elm_entry_markup_filter_remove() with internally defined
filter callbacks,
it doesn't work. So we need a one of pointer for saving the address of data.
10 Elm_Entry_Filter_Limit_Size lim;
11 lim.max_char_count = 20;
12 lim.max_byte_count = 0;
13 elm_entry_markup_filter_append(en, elm_entry_filter_limit_size,
&lim);
14
15 elm_entry_markup_filter_remove(en, elm_entry_filter_limit_size,
&lim);
16 lim.max_char_count = 50;
17 lim.max_byte_count = 0;
18 elm_entry_markup_filter_append(en, elm_entry_filter_limit_size,
&lim);
In this code, we expect to see the filter of entry will be renewed.
But elm_entry_markup_filter_remove() doesn't work.
Because, markup_filter does not hold the address of data when we use
the filter callback which is defined in elm_entry.c
_filter_new() in elm_entry.c
You can see that _filter_new allocates new pointer and names as lim2.
lim2 is saved in data of _Elm_Entry_Markup_Filter. So the address of
data doesn't equal to the input data.
---
src/lib/elm_entry.c | 3 ++-
src/lib/elm_widget_entry.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index bd76af5..c98d266 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -310,6 +310,7 @@ _filter_new(Elm_Entry_Filter_Cb func,
if (!tf) return NULL;
tf->func = func;
+ tf->orig_data = data;
if (func == elm_entry_filter_limit_size)
{
Elm_Entry_Filter_Limit_Size *lim = data, *lim2;
@@ -4190,7 +4191,7 @@ _markup_filter_remove(Eo *obj EINA_UNUSED, void *_pd,
va_list *list)
EINA_LIST_FOREACH(sd->markup_filters, l, tf)
{
- if ((tf->func == func) && ((!data) || (tf->data == data)))
+ if ((tf->func == func) && ((!data) || (tf->orig_data == data)))
{
sd->markup_filters = eina_list_remove_list(sd->markup_filters, l);
_filter_free(tf);
diff --git a/src/lib/elm_widget_entry.h b/src/lib/elm_widget_entry.h
index b2ba26e..ddb0e54 100644
--- a/src/lib/elm_widget_entry.h
+++ b/src/lib/elm_widget_entry.h
@@ -116,6 +116,7 @@ struct _Elm_Entry_Markup_Filter
{
Elm_Entry_Filter_Cb func;
void *data;
+ void *orig_data;
};
typedef enum _Length_Unit
--
------------------------------------------------------------------------------
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