cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=769fa4b592fdc5849312cef6603dbdac20041592

commit 769fa4b592fdc5849312cef6603dbdac20041592
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Fri Aug 9 09:16:45 2019 -0400

    elm_test: fix crashing in efl.ui.popup when closing windows
    
    avoid double free on pointer in callback
    
    Reviewed-by: Cedric BAIL <cedric.b...@free.fr>
    Differential Revision: https://phab.enlightenment.org/D9540
---
 src/bin/elementary/test_ui_popup.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/bin/elementary/test_ui_popup.c 
b/src/bin/elementary/test_ui_popup.c
index 89a9f0ef1b..cf809106c1 100644
--- a/src/bin/elementary/test_ui_popup.c
+++ b/src/bin/elementary/test_ui_popup.c
@@ -214,8 +214,12 @@ static void
 _win_del(void *data, const Efl_Event *ev EINA_UNUSED)
 {
    efl_ui_popup_data *p_data = data;
-   efl_unref(p_data->panel_win);
-   free(p_data);
+   Eo *win = p_data->panel_win;
+   p_data->panel_win = NULL;
+   /* only free pointer if the other window has already been freed */
+   if (!p_data->win)
+     free(p_data);
+   efl_unref(win);
    printf("window is deleted\n");
 }
 
@@ -223,8 +227,12 @@ static void
 _panel_win_del(void *data, const Efl_Event *ev EINA_UNUSED)
 {
    efl_ui_popup_data *p_data = data;
-   efl_unref(p_data->win);
-   free(p_data);
+   Eo *win = p_data->win;
+   p_data->win = NULL;
+   /* only free pointer if the other window has already been freed */
+   if (!p_data->win)
+     free(p_data);
+   efl_unref(win);
    printf("window is deleted\n");
 }
 

-- 


Reply via email to