Skip to content

Commit 3bed70b

Browse files
committed
Use correct timeout when idle pipe becomes readable
Thanks to @jneem for catching this. Signed-off-by: Uli Schlachter <[email protected]>
1 parent 50dd017 commit 3bed70b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

druid-shell/src/platform/x11/application.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ fn poll_with_timeout(conn: &Rc<XCBConnection>, idle: RawFd, timer_timeout: Optio
546546
}
547547
}
548548

549+
let earliest_timeout = idle_timeout.min(timer_timeout.unwrap_or(idle_timeout));
549550
let fd = conn.as_raw_fd();
550551
let mut both_poll_fds = [
551552
PollFd::new(fd, PollFlags::POLLIN),
@@ -582,7 +583,7 @@ fn poll_with_timeout(conn: &Rc<XCBConnection>, idle: RawFd, timer_timeout: Optio
582583
// Now that we got signalled, stop polling from the idle pipe and use a timeout
583584
// instead.
584585
poll_fds = &mut just_connection;
585-
poll_timeout = to_timeout(idle_timeout, now);
586+
poll_timeout = to_timeout(earliest_timeout, now);
586587
if now >= idle_timeout {
587588
break;
588589
}

0 commit comments

Comments
 (0)