aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2013-02-08 07:15:54 +0000
committerCedric BAIL <cedric.bail@free.fr>2013-02-08 07:15:54 +0000
commitba93ddb0de9c94cf6dfc08f1e973d1cde34975c1 (patch)
tree399a02f6c43a26327adeba69846b72fd759183b2
parentac9841acb5234fc76a60beab05c98be9937af9bc (diff)
downloadenlightenment-ba93ddb0de9c94cf6dfc08f1e973d1cde34975c1.tar.gz
enlightenment-ba93ddb0de9c94cf6dfc08f1e973d1cde34975c1.tar.xz
enlightenment-ba93ddb0de9c94cf6dfc08f1e973d1cde34975c1.zip
e: efreet_menu_parse is not thread safe.
SVN revision: 83762
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--src/bin/e_int_menus.c90
3 files changed, 35 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index 3d3bb85c3..64fff6196 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-02-08 Cedric Bail
+
+ * remove call to efreet_menu_parse from a thread.
+
2013-02-07 Cedric Bail
* enable image preloading for all e_widget_preview using edje
diff --git a/NEWS b/NEWS
index e95ce07af..691bfdc2a 100644
--- a/NEWS
+++ b/NEWS
@@ -167,3 +167,4 @@ Fixes:
* fix filemanager efreet cache listeners and updates
* fix clock timerfd usage to actually detect date changes
* keyboard mapping change now also disables for window class "vmware"
+ * don't call efreet_menu_parse from a thread
diff --git a/src/bin/e_int_menus.c b/src/bin/e_int_menus.c
index 9deeb3b49..02a45c737 100644
--- a/src/bin/e_int_menus.c
+++ b/src/bin/e_int_menus.c
@@ -67,7 +67,6 @@ static Eina_Bool _e_int_menus_efreet_desktop_cache_update(void *d, int type,
/* local subsystem globals */
static Eina_Hash *_e_int_menus_augmentation = NULL;
static Eina_List *_e_int_menus_augmentation_disabled = NULL;
-static Eina_List *_e_int_menus_app_threads = NULL;
static Eina_Hash *_e_int_menus_app_menus = NULL;
static Eina_Hash *_e_int_menus_app_menus_waiting = NULL;
static Efreet_Menu *_e_int_menus_app_menu_default = NULL;
@@ -534,7 +533,6 @@ e_int_menus_init(void)
EINTERN void
e_int_menus_shutdown(void)
{
- E_FREE_LIST(_e_int_menus_app_threads, ecore_thread_cancel);
if (_e_int_menus_app_cleaner) ecore_timer_del(_e_int_menus_app_cleaner);
_e_int_menus_app_cleaner = NULL;
eina_hash_free(_e_int_menus_app_menus_waiting);
@@ -706,65 +704,11 @@ _e_int_menus_apps_scan(E_Menu *m, Efreet_Menu *menu)
static Eina_Bool
_e_int_menus_app_cleaner_cb(void *d __UNUSED__)
{
- if (_e_int_menus_app_threads) return EINA_TRUE;
eina_hash_free_buckets(_e_int_menus_app_menus);
return EINA_TRUE;
}
static void
-_e_int_menus_app_thread_notify_cb(void *data, Ecore_Thread *eth __UNUSED__, void *msg)
-{
- Efreet_Menu *menu = msg;
- E_Menu *m;
- const char *dir = data;
-
- if (!msg) return;
- eina_hash_add(_e_int_menus_app_menus, dir, menu);
- m = eina_hash_set(_e_int_menus_app_menus_waiting, dir, NULL);
- if (!m) return;
- e_object_del_attach_func_set(E_OBJECT(m), NULL);
-
- if (_e_int_menus_app_cleaner)
- ecore_timer_reset(_e_int_menus_app_cleaner);
- else
- _e_int_menus_app_cleaner = ecore_timer_add(300, _e_int_menus_app_cleaner_cb, NULL);
- eina_stringshare_del(dir);
- _e_int_menus_apps_scan(m, menu);
- e_menu_pre_activate_callback_set(m, NULL, NULL);
- e_object_data_set(E_OBJECT(m), menu);
- e_object_free_attach_func_set(E_OBJECT(m),
- _e_int_menus_apps_free_hook2);
-}
-
-static void
-_e_int_menus_app_thread_end_cb(void *data, Ecore_Thread *eth)
-{
- char buf[PATH_MAX];
- const char *dir;
-
- _e_int_menus_app_threads = eina_list_remove(_e_int_menus_app_threads, eth);
- if (data || (!e_config->menu_apps_show)) return;
-
- e_user_dir_concat_static(buf, "applications/menu/favorite.menu");
- dir = eina_stringshare_add(buf);
-
- if (eina_hash_find(_e_int_menus_app_menus, dir))
- eina_stringshare_del(dir);
- else
- _e_int_menus_apps_thread_new(NULL, dir);
-}
-
-static void
-_e_int_menus_app_thread_cb(void *data, Ecore_Thread *eth)
-{
- const char *dir = data;
- Efreet_Menu *menu;
-
- menu = efreet_menu_parse(dir);
- ecore_thread_feedback(eth, menu);
-}
-
-static void
_e_int_menus_apps_menu_del(void *data)
{
const char *dir;
@@ -778,7 +722,7 @@ _e_int_menus_apps_thread_new(E_Menu *m, const char *dir)
{
Efreet_Menu *menu = NULL;
E_Menu *mn = NULL;
- Ecore_Thread *eth;
+ char buf[PATH_MAX];
if (dir)
{
@@ -808,9 +752,35 @@ _e_int_menus_apps_thread_new(E_Menu *m, const char *dir)
if (dir && m)
eina_hash_add(_e_int_menus_app_menus_waiting, dir, m);
- eth = ecore_thread_feedback_run(_e_int_menus_app_thread_cb, _e_int_menus_app_thread_notify_cb,
- _e_int_menus_app_thread_end_cb, _e_int_menus_app_thread_end_cb, dir, EINA_FALSE);
- _e_int_menus_app_threads = eina_list_append(_e_int_menus_app_threads, eth);
+ menu = efreet_menu_parse(dir);
+
+ eina_hash_add(_e_int_menus_app_menus, dir, menu);
+ mn = eina_hash_set(_e_int_menus_app_menus_waiting, dir, NULL);
+ if (!mn) goto on_end;
+ e_object_del_attach_func_set(E_OBJECT(mn), NULL);
+
+ if (_e_int_menus_app_cleaner)
+ ecore_timer_reset(_e_int_menus_app_cleaner);
+ else
+ _e_int_menus_app_cleaner = ecore_timer_add(300, _e_int_menus_app_cleaner_cb, NULL);
+ eina_stringshare_del(dir);
+ _e_int_menus_apps_scan(m, menu);
+ e_menu_pre_activate_callback_set(m, NULL, NULL);
+ e_object_data_set(E_OBJECT(m), menu);
+ e_object_free_attach_func_set(E_OBJECT(m),
+ _e_int_menus_apps_free_hook2);
+
+ if (!e_config->menu_apps_show) goto on_end;
+
+ e_user_dir_concat_static(buf, "applications/menu/favorite.menu");
+ dir = eina_stringshare_add(buf);
+
+ if (eina_hash_find(_e_int_menus_app_menus, dir))
+ eina_stringshare_del(dir);
+ else
+ _e_int_menus_apps_thread_new(NULL, dir);
+
+ on_end:
if (m) e_object_del_attach_func_set(E_OBJECT(m), _e_int_menus_apps_menu_del);
return NULL;
}