[PATCH] event-loop: Use two-step destruction of event loop sources.
jadahl at gmail.com
Tue Mar 20 07:50:01 PDT 2012
On Tue, Mar 20, 2012 at 3:40 PM, Kristian Høgsberg <krh at bitplanet.net> wrote:
> On Tue, Mar 20, 2012 at 9:21 AM, Jonas Ådahl <jadahl at gmail.com> wrote:
>> Instead of directly destroying an event source upon removal only destroy
>> it in case its event loop is not dispatching. If dispatching the event
>> source is marked for destruction and added to the check list and
>> destroyed in post_dispatch_check(); if not it is destroyed immediately.
> Good catch and thanks for tracking it down. The patch is pretty good,
> but there's just a couple of changes I'd like to see: 1) don't
> distinguish between dispatching or not, just always defer the destroy,
> 2) don't introduce a function pointer when all callers just need free
> and 3) move the int fd from all the source subclasses into
> wl_event_source and set it to -1 in wl_event_source_destroy and put if
> on a new loop->destroy_list (can't use check list for destroying, not
> all sources are checked) and 4) don't dispatch epoll events for
> sources with fd = -1 and then add a loop after the epoll for loop to
> destroy sources on the destroy list.
Thanks. I'll take care of the changes you mention, verify that I can
no longer reproduce the crash then submit a new patch.
More information about the wayland-devel