mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
client: Don't cancel a roundtrip when any event is received
Since wl_display_dispatch() returns the number of processed events or -1
on error, only cancel the roundtrip if an -1 is returned.
This also fixes a potential memory corruption bug happening when
wl_display_roundtrip() does an early return and the callback later
writes to the then out of scope stack allocated `done' parameter.
Introduced by 33b7637b45.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
This commit is contained in:
parent
5df752ab16
commit
d7a63fdbfb
1 changed files with 4 additions and 1 deletions
|
|
@ -649,9 +649,12 @@ wl_display_roundtrip(struct wl_display *display)
|
|||
done = 0;
|
||||
callback = wl_display_sync(display);
|
||||
wl_callback_add_listener(callback, &sync_listener, &done);
|
||||
while (!done && !ret)
|
||||
while (!done && ret >= 0)
|
||||
ret = wl_display_dispatch(display);
|
||||
|
||||
if (ret == -1 && !done)
|
||||
wl_callback_destroy(callback);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue