forked from enlightenment/efl
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
This commit is contained in:
parent
e6af6c7a7b
commit
e2944780fa
|
@ -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…
Reference in New Issue