瀏覽代碼

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.
Andreas Kling 5 年之前
父節點
當前提交
e5933ec739
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Libraries/LibCore/EventLoop.cpp

+ 2 - 2
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<NotifierReadEvent>(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<NotifierWriteEvent>(notifier->fd()));
         }
     }