We are currently returning FALSE from performWork() when condition contains HUP or ERR which makes the source to be destroyed, but it's not removed from the event source list. When unregisterEventSourceHandler() is called the source might be destroyed already. To avoid that we can simply return TRUE from the callback unless it has been cancelled (condition = 0) which happens in unregisterEventSourceHandler().
Created attachment 87836 [details]
This patch applies on top of patch attached to bug #57540
Comment on attachment 87836 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=87836&action=review
> if (!queue->m_isValid)
> - return FALSE;
> + return;
It appears that Mac does not cancel the source either if the queue is invalid. Do you know in what cases this can happen?
Committed r83281: <http://trac.webkit.org/changeset/83281>