mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-31 13:05:52 +01:00
Fixed code in wevent.c to allow the callback handler to remove its InputHandler
if the peer closed connection.
This commit is contained in:
@@ -784,6 +784,7 @@ W_WaitForEvent(Display *dpy, unsigned long xeventmask)
|
|||||||
k = 1;
|
k = 1;
|
||||||
while (handler) {
|
while (handler) {
|
||||||
int mask;
|
int mask;
|
||||||
|
InputHandler *next;
|
||||||
|
|
||||||
mask = 0;
|
mask = 0;
|
||||||
|
|
||||||
@@ -796,12 +797,14 @@ W_WaitForEvent(Display *dpy, unsigned long xeventmask)
|
|||||||
if (fds[k].revents & (POLLHUP | POLLNVAL | POLLERR))
|
if (fds[k].revents & (POLLHUP | POLLNVAL | POLLERR))
|
||||||
mask |= WIExceptMask;
|
mask |= WIExceptMask;
|
||||||
|
|
||||||
|
next = handler->next;
|
||||||
|
|
||||||
if (mask!=0 && handler->callback) {
|
if (mask!=0 && handler->callback) {
|
||||||
(*handler->callback)(handler->fd, mask,
|
(*handler->callback)(handler->fd, mask,
|
||||||
handler->clientData);
|
handler->clientData);
|
||||||
}
|
}
|
||||||
|
|
||||||
handler = handler->next;
|
handler = next;
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -875,6 +878,7 @@ W_WaitForEvent(Display *dpy, unsigned long xeventmask)
|
|||||||
|
|
||||||
while (handler) {
|
while (handler) {
|
||||||
int mask;
|
int mask;
|
||||||
|
InputHandler *next;
|
||||||
|
|
||||||
mask = 0;
|
mask = 0;
|
||||||
|
|
||||||
@@ -887,12 +891,14 @@ W_WaitForEvent(Display *dpy, unsigned long xeventmask)
|
|||||||
if (FD_ISSET(handler->fd, &eset))
|
if (FD_ISSET(handler->fd, &eset))
|
||||||
mask |= WIExceptMask;
|
mask |= WIExceptMask;
|
||||||
|
|
||||||
|
next = handler->next;
|
||||||
|
|
||||||
if (mask!=0 && handler->callback) {
|
if (mask!=0 && handler->callback) {
|
||||||
(*handler->callback)(handler->fd, mask,
|
(*handler->callback)(handler->fd, mask,
|
||||||
handler->clientData);
|
handler->clientData);
|
||||||
}
|
}
|
||||||
|
|
||||||
handler = handler->next;
|
handler = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user