Wayland: destroyed objects and events
Maxim Kartashev
maxim.kartashev at jetbrains.com
Thu Nov 10 17:03:32 UTC 2022
I was wondering if there's a good way of dealing with events that come from
objects that are being concurrently destroyed. The scenario is as follows:
let's say a callback is created like so
wl_frame_callback = wl_surface_frame(wl_surface);
payload = malloc(...);
wl_callback_add_listener(wl_frame_callback, &wl_frame_callback_listener,
payload);
and soon after that there's
wl_surface_destroy(wl_surface);
free(payload);
It seems like if the frame event has already been "scheduled" to be fired
at the point of wl_surface_destroy(), it might be actually delivered and
the callback defined by wl_frame_callback_listener will get invoked with
"payload" being free'ed already.
Is there a good way to make sure wl_frame_callback will never fire past the
point of wl_surface_destroy()?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/wakefield-dev/attachments/20221110/83c24701/attachment.htm>
More information about the wakefield-dev
mailing list