summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wl2/ecore_wl2_display.c
diff options
context:
space:
mode:
authorHosang Kim <hosang12.kim@samsung.com>2020-08-19 11:50:31 +0000
committerChristopher Michael <devilhorns@comcast.net>2020-08-22 08:25:06 -0400
commite2944780fad775de31f99fc8dd6d93528bbdc7ae (patch)
tree5441ee495ceb5361c7dd9f85728786d2dba94347 /src/lib/ecore_wl2/ecore_wl2_display.c
parente6af6c7a7bc3d3b08b263724e968c90808ab514f (diff)
ecore_wl2_display: move wl_display_dispatch_pending before condition check.
Sometimes display ref count is not zero after wl_display_dispatch_pending. For example, wl_data_source_listener's callback is called by wl_display_dispatch_pending. Display ref count is not zero but display is cleaned up, it makes double free corruption. Reviewed-by: Christopher Michael <devilhorns@comcast.net> Differential Revision: https://phab.enlightenment.org/D12109
Diffstat (limited to 'src/lib/ecore_wl2/ecore_wl2_display.c')
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_display.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c
index a91285e466..7344cf8b74 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -965,17 +965,16 @@ EAPI void
965ecore_wl2_display_disconnect(Ecore_Wl2_Display *display) 965ecore_wl2_display_disconnect(Ecore_Wl2_Display *display)
966{ 966{
967 EINA_SAFETY_ON_NULL_RETURN(display); 967 EINA_SAFETY_ON_NULL_RETURN(display);
968 int ret;
969
970 do
971 {
972 ret = wl_display_dispatch_pending(display->wl.display);
973 } while (ret > 0);
968 974
969 --display->refs; 975 --display->refs;
970 if (display->refs == 0) 976 if (display->refs == 0)
971 { 977 {
972 int ret;
973
974 do
975 {
976 ret = wl_display_dispatch_pending(display->wl.display);
977 } while (ret > 0);
978
979 _ecore_wl2_display_cleanup(display); 978 _ecore_wl2_display_cleanup(display);
980 979
981 wl_display_disconnect(display->wl.display); 980 wl_display_disconnect(display->wl.display);