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
devs/stefan/testing
Hosang Kim 2 years ago committed by Christopher Michael
parent e6af6c7a7b
commit e2944780fa
  1. 13
      src/lib/ecore_wl2/ecore_wl2_display.c

@ -965,17 +965,16 @@ EAPI void
ecore_wl2_display_disconnect(Ecore_Wl2_Display *display)
{
EINA_SAFETY_ON_NULL_RETURN(display);
int ret;
do
{
ret = wl_display_dispatch_pending(display->wl.display);
} while (ret > 0);
--display->refs;
if (display->refs == 0)
{
int ret;
do
{
ret = wl_display_dispatch_pending(display->wl.display);
} while (ret > 0);
_ecore_wl2_display_cleanup(display);
wl_display_disconnect(display->wl.display);

Loading…
Cancel
Save