# gpui: Fix busyloop on X disconnect \(\#41986\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/e6f571c1db76966d9d7d896ab632b5d2dd40a9d7)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: e6f571c1db76966d9d7d896ab632b5d2dd40a9d7

Requested commit: e6f571c1db76966d9d7d896ab632b5d2dd40a9d7

Commit: e6f571c1db76966d9d7d896ab632b5d2dd40a9d7

Tree: 6fc3718668f60605688a02161afd67780c6fe930

Author: kitt

Committer: GitHub

## Message

```
gpui: Fix busyloop on X disconnect (#41986)

When the connection to X is broken zed will go into an infinite loop and
eat up 100% (of one core) of CPU; this change causes it to exit with an
error instead.

I encountered this behavior while running zed in
[Xephyr](https://freedesktop.org/wiki/Software/Xephyr/) for testing,
though I do sometimes terminate my X server as a way to log out or
attempt to recover from a (very) broken state, and I appreciate a
graceful exit in those situations!

Exiting in case of X server disconnect is common practice in my
observations, likely as the difficulty of recreating state stored
server-side outweighs the potential utility in attempting to recover (if
"reconnecting" to an X server is ever desired in regular usage,
[Xpra](https://xpra.org/index.html) might be able to help!).


Release Notes:

- N/A
```

## Parents

- [2c0d6c067d874a450c02ce614a3dfce5f3ea12d1](https://git.cafe/gitcafe/zed/commit/2c0d6c067d874a450c02ce614a3dfce5f3ea12d1?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/e6f571c1db76966d9d7d896ab632b5d2dd40a9d7?format=markdown)
