summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-08-09 09:16:45 -0400
committerCedric BAIL <cedric.bail@free.fr>2019-08-09 10:25:37 -0700
commit769fa4b592fdc5849312cef6603dbdac20041592 (patch)
tree5a338e365d4a81655911c473bdd67fdec416fb5b /src
parent189ddd9c818e58ca8679a4c0b722ab487c8a55cc (diff)
elm_test: fix crashing in efl.ui.popup when closing windows
avoid double free on pointer in callback Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D9540
Diffstat (limited to '')
-rw-r--r--src/bin/elementary/test_ui_popup.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/bin/elementary/test_ui_popup.c b/src/bin/elementary/test_ui_popup.c
index 89a9f0e..cf80910 100644
--- a/src/bin/elementary/test_ui_popup.c
+++ b/src/bin/elementary/test_ui_popup.c
@@ -214,8 +214,12 @@ static void
214_win_del(void *data, const Efl_Event *ev EINA_UNUSED) 214_win_del(void *data, const Efl_Event *ev EINA_UNUSED)
215{ 215{
216 efl_ui_popup_data *p_data = data; 216 efl_ui_popup_data *p_data = data;
217 efl_unref(p_data->panel_win); 217 Eo *win = p_data->panel_win;
218 free(p_data); 218 p_data->panel_win = NULL;
219 /* only free pointer if the other window has already been freed */
220 if (!p_data->win)
221 free(p_data);
222 efl_unref(win);
219 printf("window is deleted\n"); 223 printf("window is deleted\n");
220} 224}
221 225
@@ -223,8 +227,12 @@ static void
223_panel_win_del(void *data, const Efl_Event *ev EINA_UNUSED) 227_panel_win_del(void *data, const Efl_Event *ev EINA_UNUSED)
224{ 228{
225 efl_ui_popup_data *p_data = data; 229 efl_ui_popup_data *p_data = data;
226 efl_unref(p_data->win); 230 Eo *win = p_data->win;
227 free(p_data); 231 p_data->win = NULL;
232 /* only free pointer if the other window has already been freed */
233 if (!p_data->win)
234 free(p_data);
235 efl_unref(win);
228 printf("window is deleted\n"); 236 printf("window is deleted\n");
229} 237}
230 238