Files
oak-gpui/crates
Matthias Grandl 4024b9ac4d gpui: Fix start_display_link leading to resource leak on hidden windows (#11289)
Release Notes:

- N/A

While developing [Loungy](https://loungy.app), I noticed that everytime
I wake my laptop, Loungy starts consuming 100% CPU. I traced it down to
`start_display_link` as there was this error message at the time of wake
up:

```
[2024-05-02T05:02:31Z ERROR util] /Users/matthias/zed/crates/gpui/src/platform/mac/window.rs:420: could not create display link, code: -6661
```

The timeline is this:

1. The application is hidden with `cx.hide()`
2. The system is put to sleep and later woken up
3. `window_did_change_screen` would trigger immediately after wakeup,
calling `start_display_link`
4. `start_display_link` fails catastrophically as `DisplayLink::new`
starts hogging all the CPU for some reason?
5. throws the error message above
6. Once the window is opened, `window_did_change_occlusion_state` it
retriggers `start_display_link` and the CPU issue subsides
2024-05-03 10:35:51 +02:00
..
2024-04-30 16:09:43 -06:00
2024-04-23 15:33:09 -06:00
2024-04-23 13:31:21 -04:00
2024-03-28 18:32:11 +01:00
2024-04-11 15:36:35 -06:00
2024-04-30 16:09:43 -06:00
2024-04-26 13:25:25 -06:00
2024-04-30 23:31:59 -06:00
2024-03-20 15:52:02 +01:00
2024-03-11 10:45:57 +01:00
2024-03-26 16:10:09 -07:00
2024-04-26 13:25:25 -06:00
2024-04-29 16:37:37 -04:00
2024-03-14 17:05:07 -04:00
2024-04-11 23:09:12 +02:00
2024-04-29 16:37:37 -04:00
2024-05-01 14:28:52 -04:00
2024-04-15 14:21:52 +02:00