--- rxvt-unicode/src/iom.C 2003/11/24 17:28:08 1.1 +++ rxvt-unicode/src/iom.C 2003/11/25 17:11:33 1.3 @@ -41,6 +41,8 @@ { if (iom_valid) iom.unreg (this); + + at = TSTAMP_CANCEL; } io_watcher::~io_watcher () @@ -102,9 +104,8 @@ // call it w->call (*w); - // re-add it if necessary - if (w->at >= 0) - reg (w); + if (w->at < 0) + unreg (w); } struct timeval to; @@ -120,19 +121,19 @@ int fds = 0; for (io_watcher **w = iow.begin (); w < iow.end (); ++w) - { - if ((*w)->events & EVENT_READ ) FD_SET ((*w)->fd, &rfd); - if ((*w)->events & EVENT_WRITE) FD_SET ((*w)->fd, &wfd); + { + if ((*w)->events & EVENT_READ ) FD_SET ((*w)->fd, &rfd); + if ((*w)->events & EVENT_WRITE) FD_SET ((*w)->fd, &wfd); - if ((*w)->fd > fds) fds = (*w)->fd; - } + if ((*w)->fd > fds) fds = (*w)->fd; + } fds = select (fds + 1, &rfd, &wfd, 0, &to); set_now (); if (fds > 0) - for (io_watcher **w = iow.begin (); w < iow.end (); w++) + for (io_watcher **w = iow.begin (); w < iow.end (); ++w) { short revents = (*w)->events;