summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitalii Vorobiov <vi.vorobiov@samsung.com>2014-11-22 11:05:59 +0900
committerChunEon Park <hermet@hermet.pe.kr>2014-11-22 11:08:36 +0900
commit079391717d4de6a4c6e3af34a9043ff1d07bd8a0 (patch)
tree514c0542ec87b85f85364e4921e2c0d928985dee
parentd9480f540c7dbc113686400f3596d5e13e839329 (diff)
DBUS Menu: fixing SIGSEV and SIGBUS when trying to use dbus.
Summary: Using of dbus menu causes a weird exception that looks like this (for example in function elm_win_main_menu_get(Evas_Object *win)): > EINA: Data at address 0x0 is invalid. Replacing with zero page. > mmap: Operation not permitted > ERR<22270>:eina_mmap lib/eina/eina_mmap.c:110 _eina_mmap_safe_sigbus() > Failed to mmap() /dev/zero in place of page. SIGBUS!!! > Aborted (core dumped) This issue appears because there is a lot of places where Elm_Object_Item is used, but it should be Elm_Menu_Item_Data. This issue could be reproduced with elementary_test: 1. run elementary test with dbus enabled. 2. find "Systray Item" button and click on it. 3. get SIGSEV in your console. @fix Reviewers: cedric, raster, seoz, Hermet Reviewed By: Hermet Subscribers: reutskiy.v.v Differential Revision: https://phab.enlightenment.org/D1681
-rw-r--r--AUTHORS1
-rw-r--r--src/lib/elm_dbus_menu.c22
2 files changed, 14 insertions, 9 deletions
diff --git a/AUTHORS b/AUTHORS
index ec475be1b..7b1f314d0 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -159,3 +159,4 @@ Jae Yong Hwang <j_yong.hwang@samsung.com>
159Kabeer Khan <kabeer.khan@samsung.com> 159Kabeer Khan <kabeer.khan@samsung.com>
160yinsc <shouchen.yin@samsung.com> 160yinsc <shouchen.yin@samsung.com>
161Woochan Lee <wc0917.lee@samsung.com> 161Woochan Lee <wc0917.lee@samsung.com>
162Vitalii Vorobiov <vi.vorobiov@samsung.com>
diff --git a/src/lib/elm_dbus_menu.c b/src/lib/elm_dbus_menu.c
index 84a5e5937..43f270dcd 100644
--- a/src/lib/elm_dbus_menu.c
+++ b/src/lib/elm_dbus_menu.c
@@ -63,7 +63,7 @@ _menu_add_recursive(Elm_DBus_Menu *dbus_menu, Elm_Menu_Item_Data *item)
63{ 63{
64 int32_t id; 64 int32_t id;
65 Eina_List *l; 65 Eina_List *l;
66 Elm_Menu_Item_Data *subitem; 66 Elm_Object_Item *obj_subitem;
67 67
68 id = ++dbus_menu->timestamp; 68 id = ++dbus_menu->timestamp;
69 if (!eina_hash_add(dbus_menu->elements, &id, item)) 69 if (!eina_hash_add(dbus_menu->elements, &id, item))
@@ -71,8 +71,9 @@ _menu_add_recursive(Elm_DBus_Menu *dbus_menu, Elm_Menu_Item_Data *item)
71 71
72 item->dbus_idx = id; 72 item->dbus_idx = id;
73 73
74 EINA_LIST_FOREACH (item->submenu.items, l, subitem) 74 EINA_LIST_FOREACH (item->submenu.items, l, obj_subitem)
75 { 75 {
76 ELM_MENU_ITEM_DATA_GET(obj_subitem, subitem);
76 if (!_menu_add_recursive(dbus_menu, subitem)) 77 if (!_menu_add_recursive(dbus_menu, subitem))
77 return EINA_FALSE; 78 return EINA_FALSE;
78 } 79 }
@@ -300,8 +301,8 @@ _layout_build_recursive(Elm_Menu_Item_Data *item,
300 Eldbus_Message_Iter *iter) 301 Eldbus_Message_Iter *iter)
301{ 302{
302 Eina_List *l; 303 Eina_List *l;
303 Elm_Menu_Item_Data *subitem;
304 Eldbus_Message_Iter *layout, *array, *variant; 304 Eldbus_Message_Iter *layout, *array, *variant;
305 Elm_Object_Item *obj_subitem;
305 306
306 layout = eldbus_message_iter_container_new(iter, 'r', NULL); 307 layout = eldbus_message_iter_container_new(iter, 'r', NULL);
307 eldbus_message_iter_basic_append(layout, 'i', item->dbus_idx); 308 eldbus_message_iter_basic_append(layout, 'i', item->dbus_idx);
@@ -310,10 +311,11 @@ _layout_build_recursive(Elm_Menu_Item_Data *item,
310 311
311 if (recursion_depth > 0) 312 if (recursion_depth > 0)
312 { 313 {
313 EINA_LIST_FOREACH (item->submenu.items, l, subitem) 314 EINA_LIST_FOREACH (item->submenu.items, l, obj_subitem)
314 { 315 {
315 variant = eldbus_message_iter_container_new(array, 'v', 316 variant = eldbus_message_iter_container_new(array, 'v',
316 "(ia{sv}av)"); 317 "(ia{sv}av)");
318 ELM_MENU_ITEM_DATA_GET(obj_subitem, subitem);
317 _layout_build_recursive(subitem, property_list, 319 _layout_build_recursive(subitem, property_list,
318 recursion_depth - 1, variant); 320 recursion_depth - 1, variant);
319 eldbus_message_iter_container_close(array, variant); 321 eldbus_message_iter_container_close(array, variant);
@@ -333,7 +335,7 @@ _root_layout_build(Elm_DBus_Menu *dbus_menu, Eina_List *property_list,
333 const Eina_List *ret = NULL; 335 const Eina_List *ret = NULL;
334 Eina_List *items; 336 Eina_List *items;
335 Eina_List *l; 337 Eina_List *l;
336 Elm_Menu_Item_Data *item; 338 Elm_Object_Item *obj_item;
337 339
338 layout = eldbus_message_iter_container_new(iter, 'r', NULL); 340 layout = eldbus_message_iter_container_new(iter, 'r', NULL);
339 eldbus_message_iter_basic_append(layout, 'i', 0); 341 eldbus_message_iter_basic_append(layout, 'i', 0);
@@ -360,10 +362,11 @@ _root_layout_build(Elm_DBus_Menu *dbus_menu, Eina_List *property_list,
360 { 362 {
361 eo_do(dbus_menu->menu, ret = elm_obj_menu_items_get()); 363 eo_do(dbus_menu->menu, ret = elm_obj_menu_items_get());
362 items = (Eina_List *)ret; 364 items = (Eina_List *)ret;
363 EINA_LIST_FOREACH (items, l, item) 365 EINA_LIST_FOREACH (items, l, obj_item)
364 { 366 {
365 variant = eldbus_message_iter_container_new(array, 'v', 367 variant = eldbus_message_iter_container_new(array, 'v',
366 "(ia{sv}av)"); 368 "(ia{sv}av)");
369 ELM_MENU_ITEM_DATA_GET(obj_item, item);
367 _layout_build_recursive(item, property_list, 370 _layout_build_recursive(item, property_list,
368 recursion_depth - 1, variant); 371 recursion_depth - 1, variant);
369 eldbus_message_iter_container_close(array, variant); 372 eldbus_message_iter_container_close(array, variant);
@@ -420,7 +423,7 @@ _elm_dbus_menu_add(Eo *menu)
420 Elm_DBus_Menu *dbus_menu; 423 Elm_DBus_Menu *dbus_menu;
421 const Eina_List *ret = NULL; 424 const Eina_List *ret = NULL;
422 Eina_List *items, *l; 425 Eina_List *items, *l;
423 Elm_Menu_Item_Data *item; 426 Elm_Object_Item *obj_item;
424 427
425 ELM_MENU_CHECK(menu) NULL; 428 ELM_MENU_CHECK(menu) NULL;
426 429
@@ -442,8 +445,9 @@ _elm_dbus_menu_add(Eo *menu)
442 445
443 eo_do(menu, ret = elm_obj_menu_items_get()); 446 eo_do(menu, ret = elm_obj_menu_items_get());
444 items = (Eina_List *)ret; 447 items = (Eina_List *)ret;
445 EINA_LIST_FOREACH (items, l, item) 448 EINA_LIST_FOREACH (items, l, obj_item)
446 { 449 {
450 ELM_MENU_ITEM_DATA_GET(obj_item, item);
447 if (!_menu_add_recursive(dbus_menu, item)) 451 if (!_menu_add_recursive(dbus_menu, item))
448 { 452 {
449 ERR("Unable to add menu item"); 453 ERR("Unable to add menu item");