stablize unstable worker threads.
Still there are unsafe thread functions that access invalid memory. fix all of them.
This commit is contained in:
parent
d3b0347ffd
commit
1e5ae3db45
|
@ -261,7 +261,6 @@ static Eina_Bool
|
||||||
syntax_color_timer_cb(void *data)
|
syntax_color_timer_cb(void *data)
|
||||||
{
|
{
|
||||||
edit_data *ed = data;
|
edit_data *ed = data;
|
||||||
if (!color_ready(syntax_color_data_get(ed->sh))) return ECORE_CALLBACK_RENEW;
|
|
||||||
syntax_color_apply(ed, EINA_TRUE);
|
syntax_color_apply(ed, EINA_TRUE);
|
||||||
ed->syntax_color_timer = NULL;
|
ed->syntax_color_timer = NULL;
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
|
@ -406,7 +405,6 @@ edit_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
Elm_Entry_Change_Info *info = event_info;
|
Elm_Entry_Change_Info *info = event_info;
|
||||||
edit_data *ed = data;
|
edit_data *ed = data;
|
||||||
edit_changed_set(ed, EINA_TRUE);
|
edit_changed_set(ed, EINA_TRUE);
|
||||||
parser_macro_update(ed->pd, EINA_TRUE);
|
|
||||||
|
|
||||||
Eina_Bool syntax_color = EINA_TRUE;
|
Eina_Bool syntax_color = EINA_TRUE;
|
||||||
ed->error_line = -1;
|
ed->error_line = -1;
|
||||||
|
|
|
@ -60,8 +60,6 @@ struct parser_s
|
||||||
cur_context_td *cntd;
|
cur_context_td *cntd;
|
||||||
type_init_td *titd;
|
type_init_td *titd;
|
||||||
bracket_td *btd;
|
bracket_td *btd;
|
||||||
|
|
||||||
Eina_Bool macro_update : 1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,9 +111,6 @@ cur_context_thread_blocking(void *data, Ecore_Thread *thread)
|
||||||
|
|
||||||
if (!collections) bracket = 1;
|
if (!collections) bracket = 1;
|
||||||
|
|
||||||
if (td->pd->macro_update)
|
|
||||||
parser_macro_update(td->pd, EINA_FALSE);
|
|
||||||
|
|
||||||
td->part_name = NULL;
|
td->part_name = NULL;
|
||||||
td->group_name = NULL;
|
td->group_name = NULL;
|
||||||
td->state_name = NULL;
|
td->state_name = NULL;
|
||||||
|
@ -2006,12 +2001,6 @@ parser_is_image_name(const Evas_Object *entry, const char *str)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
parser_macro_update(parser_data *pd, Eina_Bool macro_update)
|
|
||||||
{
|
|
||||||
pd->macro_update = macro_update;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
parser_bracket_cancel(parser_data *pd)
|
parser_bracket_cancel(parser_data *pd)
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,7 +98,6 @@ void color_set(color_data *cd, Enventor_Syntax_Color_Type color_type, const char
|
||||||
const char *color_value_get(Enventor_Syntax_Color_Type color_type);
|
const char *color_value_get(Enventor_Syntax_Color_Type color_type);
|
||||||
const char *color_cancel(Ecore_Thread *thread, color_data *cd, const char *str, int length, int from_pos, int to_pos, char **from, char **to);
|
const char *color_cancel(Ecore_Thread *thread, color_data *cd, const char *str, int length, int from_pos, int to_pos, char **from, char **to);
|
||||||
const char *color_apply(Ecore_Thread *thread, color_data *cd, const char *str, int length, char *from, char *to);
|
const char *color_apply(Ecore_Thread *thread, color_data *cd, const char *str, int length, char *from, char *to);
|
||||||
Eina_Bool color_ready(color_data *cd);
|
|
||||||
|
|
||||||
|
|
||||||
/*parser */
|
/*parser */
|
||||||
|
@ -121,7 +120,6 @@ Eina_Bool parser_images_pos_get(const Evas_Object *entry, int *ret);
|
||||||
Eina_Bool parser_is_image_name(const Evas_Object *entry, const char *str);
|
Eina_Bool parser_is_image_name(const Evas_Object *entry, const char *str);
|
||||||
Eina_Bool parser_styles_pos_get(const Evas_Object *entry, int *ret);
|
Eina_Bool parser_styles_pos_get(const Evas_Object *entry, int *ret);
|
||||||
Eina_Bool parser_state_info_get(Evas_Object *entry, state_info *info);
|
Eina_Bool parser_state_info_get(Evas_Object *entry, state_info *info);
|
||||||
void parser_macro_update(parser_data *pd, Eina_Bool macro_update);
|
|
||||||
typedef void (*Bracket_Update_Cb)(void *data, int left, int right);
|
typedef void (*Bracket_Update_Cb)(void *data, int left, int right);
|
||||||
void parser_bracket_find(parser_data *pd, Evas_Object *entry, Bracket_Update_Cb func, void *data);
|
void parser_bracket_find(parser_data *pd, Evas_Object *entry, Bracket_Update_Cb func, void *data);
|
||||||
void parser_bracket_cancel(parser_data *pd);
|
void parser_bracket_cancel(parser_data *pd);
|
||||||
|
|
|
@ -44,11 +44,7 @@ struct syntax_color_s
|
||||||
Eina_Strbuf *strbuf;
|
Eina_Strbuf *strbuf;
|
||||||
Eina_Strbuf *cachebuf;
|
Eina_Strbuf *cachebuf;
|
||||||
Eina_List *macros;
|
Eina_List *macros;
|
||||||
Ecore_Thread *thread;
|
|
||||||
syntax_color_source *col_src;
|
syntax_color_source *col_src;
|
||||||
|
|
||||||
Eina_Bool ready : 1;
|
|
||||||
Eina_Bool term : 1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct color_hash_foreach_data
|
typedef struct color_hash_foreach_data
|
||||||
|
@ -218,34 +214,6 @@ macro_key_push(color_data *cd, char *str)
|
||||||
if (cut) free(key);
|
if (cut) free(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
init_thread_cancel(void *data, Ecore_Thread *thread EINA_UNUSED)
|
|
||||||
{
|
|
||||||
color_data *cd = data;
|
|
||||||
cd->thread = NULL;
|
|
||||||
|
|
||||||
if (cd->term) color_term(cd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
init_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED)
|
|
||||||
{
|
|
||||||
color_data *cd = data;
|
|
||||||
|
|
||||||
//Initialize color table once.
|
|
||||||
if (init_count == 1)
|
|
||||||
{
|
|
||||||
eddc_init();
|
|
||||||
color_load();
|
|
||||||
eddc_term();
|
|
||||||
color_table_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
cd->col_src = &g_color_src;
|
|
||||||
cd->thread = NULL;
|
|
||||||
cd->ready = EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
color_markup_insert_internal(Eina_Strbuf *strbuf, const char **src, int length,
|
color_markup_insert_internal(Eina_Strbuf *strbuf, const char **src, int length,
|
||||||
char **cur, char **prev, const char *cmp,
|
char **cur, char **prev, const char *cmp,
|
||||||
|
@ -741,9 +709,15 @@ color_init(Eina_Strbuf *strbuf)
|
||||||
|
|
||||||
cd->strbuf = strbuf;
|
cd->strbuf = strbuf;
|
||||||
cd->cachebuf = eina_strbuf_new();
|
cd->cachebuf = eina_strbuf_new();
|
||||||
cd->thread = ecore_thread_run(init_thread_blocking,
|
|
||||||
init_thread_cancel,
|
if (init_count == 1)
|
||||||
init_thread_cancel, cd);
|
{
|
||||||
|
eddc_init();
|
||||||
|
color_load();
|
||||||
|
eddc_term();
|
||||||
|
color_table_init();
|
||||||
|
}
|
||||||
|
cd->col_src = &g_color_src;
|
||||||
|
|
||||||
/* TODO: Improve to share macro info through color instances. Might be this
|
/* TODO: Improve to share macro info through color instances. Might be this
|
||||||
could be global static instance and could be shared with locking
|
could be global static instance and could be shared with locking
|
||||||
|
@ -756,13 +730,6 @@ color_init(Eina_Strbuf *strbuf)
|
||||||
void
|
void
|
||||||
color_term(color_data *cd)
|
color_term(color_data *cd)
|
||||||
{
|
{
|
||||||
if (cd->thread)
|
|
||||||
{
|
|
||||||
ecore_thread_cancel(cd->thread);
|
|
||||||
cd->term = EINA_TRUE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Eina_Stringshare *macro;
|
Eina_Stringshare *macro;
|
||||||
EINA_LIST_FREE(cd->macros, macro) eina_stringshare_del(macro);
|
EINA_LIST_FREE(cd->macros, macro) eina_stringshare_del(macro);
|
||||||
|
|
||||||
|
@ -1045,9 +1012,3 @@ finished:
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Bool
|
|
||||||
color_ready(color_data *cd)
|
|
||||||
{
|
|
||||||
return cd->ready;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue