From 85d45ee9b199967fadc65c7337a1fa3e56ac55f3 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Fri, 8 Jul 2016 14:33:01 +0900 Subject: [PATCH] elm: Fix cnp crash on WL See D4144. Original author: @slotus.lee SEG_FAULT happens when the object which has selection is deleted, and new selection is done at another object. Reason: loss_cb is not removed when the object which has selection is deleted. When new selection is set for new object, the loss_cb is called for deleted object. As result, SEG_FAULT happens. This issue was also happened in X11 (https://phab.enlightenment.org/D2763) Test plan: (on wayland environment) Run elementary test, open Entry, do selection, close Entry window, open Entry one more time, do selection. --- src/lib/elementary/elm_cnp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/elementary/elm_cnp.c b/src/lib/elementary/elm_cnp.c index 855e7d8add..26904bd4b7 100644 --- a/src/lib/elementary/elm_cnp.c +++ b/src/lib/elementary/elm_cnp.c @@ -2820,7 +2820,12 @@ static void _wl_sel_obj_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { Wl_Cnp_Selection *sel = data; - if (sel->widget == obj) sel->widget = NULL; + if (sel->widget == obj) + { + sel->loss_cb = NULL; + sel->loss_data = NULL; + sel->widget = NULL; + } if (dragwidget == obj) dragwidget = NULL; }