From e5933ec739aa9b896b2c7bb5aa8e7457b343adf4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 6 Jul 2020 23:02:07 +0200 Subject: [PATCH] LibCore: Only deliver Read/Write events to listening notifiers If a notifier has disabled read/write notifications via its event mask, we should not spam it with events, even if they have a hook callback. --- Libraries/LibCore/EventLoop.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibCore/EventLoop.cpp b/Libraries/LibCore/EventLoop.cpp index 9619cbe521..6c0a78f4c9 100644 --- a/Libraries/LibCore/EventLoop.cpp +++ b/Libraries/LibCore/EventLoop.cpp @@ -519,11 +519,11 @@ try_select_again:; for (auto& notifier : *s_notifiers) { if (FD_ISSET(notifier->fd(), &rfds)) { - if (notifier->on_ready_to_read) + if (notifier->event_mask() & Notifier::Event::Read) post_event(*notifier, make(notifier->fd())); } if (FD_ISSET(notifier->fd(), &wfds)) { - if (notifier->on_ready_to_write) + if (notifier->event_mask() & Notifier::Event::Write) post_event(*notifier, make(notifier->fd())); } }