summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-08-07 00:43:47 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-08-07 00:43:47 +0100
commitdf0a64dc7ad348935af9a57ed1bef62b7424db58 (patch)
treeee4fb2ed0ebae9c69ecf1250bf2afad81815d9b7 /src/modules
parent2b0735da580b2f5ce9f35b942a36c6072ec718de (diff)
e dbusmenu - fix cross referencing from e menus created from debus menu
this stops crashes when e menu si still up when the dbus menu backing it has changed/gone away... by referencing the dbusmenu to hang about like a bad smell while the e gui menu is up until it's dismissed. this fixes a real segv i saw with steam. @fix
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/appmenu/e_mod_appmenu_render.c27
-rw-r--r--src/modules/systray/e_mod_notifier_host.c27
2 files changed, 42 insertions, 12 deletions
diff --git a/src/modules/appmenu/e_mod_appmenu_render.c b/src/modules/appmenu/e_mod_appmenu_render.c
index 082181c..32c4240 100644
--- a/src/modules/appmenu/e_mod_appmenu_render.c
+++ b/src/modules/appmenu/e_mod_appmenu_render.c
@@ -45,8 +45,22 @@ menu_deactive(E_Menu *m)
45{ 45{
46 Eina_List *iter; 46 Eina_List *iter;
47 E_Menu_Item *mi; 47 E_Menu_Item *mi;
48 E_DBusMenu_Item *item;
49
50 item = e_object_data_get(E_OBJECT(m));
51 if (item)
52 {
53 e_object_data_set(E_OBJECT(m), NULL);
54 e_dbusmenu_item_unref(item);
55 }
48 EINA_LIST_FOREACH(m->items, iter, mi) 56 EINA_LIST_FOREACH(m->items, iter, mi)
49 { 57 {
58 item = e_object_data_get(E_OBJECT(mi));
59 if (item)
60 {
61 e_object_data_set(E_OBJECT(m), NULL);
62 e_dbusmenu_item_unref(item);
63 }
50 if (mi->submenu) 64 if (mi->submenu)
51 { 65 {
52 menu_deactive(mi->submenu); 66 menu_deactive(mi->submenu);
@@ -81,15 +95,17 @@ item_submenu_new(E_DBusMenu_Item *item, E_Menu_Item *mi)
81 95
82 m = e_menu_new(); 96 m = e_menu_new();
83 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); 97 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
84 if (mi) 98 e_dbusmenu_item_ref(item);
85 e_menu_item_submenu_set(mi, m); 99 e_object_data_set(E_OBJECT(m), item);
100 if (mi) e_menu_item_submenu_set(mi, m);
86 101
87 EINA_INLIST_FOREACH(item->sub_items, child) 102 EINA_INLIST_FOREACH(item->sub_items, child)
88 { 103 {
89 E_Menu_Item *submi; 104 E_Menu_Item *submi;
90 if (!child->visible) 105 if (!child->visible) continue;
91 continue;
92 submi = e_menu_item_new(m); 106 submi = e_menu_item_new(m);
107 e_dbusmenu_item_ref(child);
108 e_object_data_set(E_OBJECT(submi), child);
93 if (child->type == E_DBUSMENU_ITEM_TYPE_SEPARATOR) 109 if (child->type == E_DBUSMENU_ITEM_TYPE_SEPARATOR)
94 { 110 {
95 e_menu_item_separator_set(submi, 1); 111 e_menu_item_separator_set(submi, 1);
@@ -97,8 +113,7 @@ item_submenu_new(E_DBusMenu_Item *item, E_Menu_Item *mi)
97 } 113 }
98 e_menu_item_label_set(submi, child->label); 114 e_menu_item_label_set(submi, child->label);
99 e_menu_item_callback_set(submi, sub_item_clicked_cb, child); 115 e_menu_item_callback_set(submi, sub_item_clicked_cb, child);
100 if (!child->enabled) 116 if (!child->enabled) e_menu_item_disabled_set(submi, 1);
101 e_menu_item_disabled_set(submi, 1);
102 if (child->toggle_type) 117 if (child->toggle_type)
103 { 118 {
104 if (child->toggle_type == E_DBUSMENU_ITEM_TOGGLE_TYPE_CHECKMARK) 119 if (child->toggle_type == E_DBUSMENU_ITEM_TOGGLE_TYPE_CHECKMARK)
diff --git a/src/modules/systray/e_mod_notifier_host.c b/src/modules/systray/e_mod_notifier_host.c
index 46a2395..90f6929 100644
--- a/src/modules/systray/e_mod_notifier_host.c
+++ b/src/modules/systray/e_mod_notifier_host.c
@@ -130,13 +130,25 @@ _menu_post_deactivate(void *data, E_Menu *m)
130 Eina_List *iter; 130 Eina_List *iter;
131 E_Menu_Item *mi; 131 E_Menu_Item *mi;
132 E_Gadcon *gadcon = data; 132 E_Gadcon *gadcon = data;
133 E_DBusMenu_Item *item;
133 134
134 if (gadcon) 135 item = e_object_data_get(E_OBJECT(m));
135 e_gadcon_locked_set(gadcon, 0); 136 if (item)
137 {
138 e_object_data_set(E_OBJECT(m), NULL);
139 e_dbusmenu_item_unref(item);
140 }
141
142 if (gadcon) e_gadcon_locked_set(gadcon, 0);
136 EINA_LIST_FOREACH(m->items, iter, mi) 143 EINA_LIST_FOREACH(m->items, iter, mi)
137 { 144 {
138 if (mi->submenu) 145 item = e_object_data_get(E_OBJECT(mi));
139 e_menu_deactivate(mi->submenu); 146 if (item)
147 {
148 e_object_data_set(E_OBJECT(m), NULL);
149 e_dbusmenu_item_unref(item);
150 }
151 if (mi->submenu) e_menu_deactivate(mi->submenu);
140 } 152 }
141 e_object_del(E_OBJECT(m)); 153 e_object_del(E_OBJECT(m));
142} 154}
@@ -149,14 +161,17 @@ _item_submenu_new(E_DBusMenu_Item *item, E_Menu_Item *mi)
149 E_Menu_Item *submi; 161 E_Menu_Item *submi;
150 162
151 m = e_menu_new(); 163 m = e_menu_new();
164 e_dbusmenu_item_ref(item);
165 e_object_data_set(E_OBJECT(m), item);
152 e_menu_post_deactivate_callback_set(m, _menu_post_deactivate, NULL); 166 e_menu_post_deactivate_callback_set(m, _menu_post_deactivate, NULL);
153 if (mi) 167 if (mi) e_menu_item_submenu_set(mi, m);
154 e_menu_item_submenu_set(mi, m);
155 168
156 EINA_INLIST_FOREACH(item->sub_items, child) 169 EINA_INLIST_FOREACH(item->sub_items, child)
157 { 170 {
158 if (!child->visible) continue; 171 if (!child->visible) continue;
159 submi = e_menu_item_new(m); 172 submi = e_menu_item_new(m);
173 e_dbusmenu_item_ref(child);
174 e_object_data_set(E_OBJECT(submi), child);
160 if (child->type == E_DBUSMENU_ITEM_TYPE_SEPARATOR) 175 if (child->type == E_DBUSMENU_ITEM_TYPE_SEPARATOR)
161 e_menu_item_separator_set(submi, 1); 176 e_menu_item_separator_set(submi, 1);
162 else 177 else