Skip to content

gpui: Fix thermal state notifications on intel macOS#49086

Merged
bennetbo merged 2 commits intozed-industries:mainfrom
marcocondrache:nzwtpxsh
Feb 16, 2026
Merged

gpui: Fix thermal state notifications on intel macOS#49086
bennetbo merged 2 commits intozed-industries:mainfrom
marcocondrache:nzwtpxsh

Conversation

@marcocondrache
Copy link
Contributor

@marcocondrache marcocondrache commented Feb 13, 2026

Fixes #45638 (comment)
Closes #49005

The issue was similar to the one we already had with the quit method

// borrow of the app state (which most of the time we will do), we will end up

@notpeter Could you please test this branch to confirm it resolves the issue?

  • Tests or screenshots needed?
  • Code Reviewed
  • Manual QA

Release Notes:

  • Fixed an issue where Zed would randomly crash on macOS intel

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 13, 2026
@github-actions github-actions bot added the community champion Issues filed by our amazing community champions! 🫶 label Feb 13, 2026
@marcocondrache marcocondrache changed the title gpui: Fix thermal state notifications on macOS gpui: Fix thermal state notifications on intel macOS Feb 13, 2026
@notpeter
Copy link
Contributor

notpeter commented Feb 13, 2026

I built this branch and things appear to be stable (no crashes in ~10mins).
Previously I built main and it immediately panicked with:

zed.log
2026-02-13T09:04:09-05:00 INFO  [zed] ========== starting zed version 0.225.0+dev.d453d959f2ca446cd54759e89746d58e51783166, sha d453d95 ==========
2026-02-13T09:04:09-05:00 INFO  [sqlez::migrations] Found 16 foreign key relationships to check
2026-02-13T09:04:10-05:00 WARN  [zed::reliability] Minidump endpoint not set
2026-02-13T09:04:10-05:00 INFO  [extension_host] extensions updated. loading 21, reloading 0, unloading 0
2026-02-13T09:04:10-05:00 WARN  [audio::audio_settings] Denoise does not work on debug builds, not enabling
2026-02-13T09:04:10-05:00 WARN  [audio::audio_settings] Denoise does not work on debug builds, not enabling
2026-02-13T09:04:10-05:00 INFO  [workspace] Rendered first frame

thread '<unnamed>' (553723) panicked at crates/gpui/src/app.rs:749:39:
RefCell already borrowed
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/std/src/panicking.rs:689:5
   1: core::panicking::panic_fmt
             at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/core/src/panicking.rs:80:14
   2: core::cell::panic_already_borrowed::do_panic::runtime
             at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/core/src/panic.rs:173:21
   3: core::cell::panic_already_borrowed::do_panic
             at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/core/src/intrinsics/mod.rs:2449:9
   4: core::cell::panic_already_borrowed
             at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/core/src/panic.rs:178:9
   5: <core::cell::RefCell<gpui::app::App>>::borrow_mut
             at /Users/peter/.rustup/toolchains/1.93-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/cell.rs:1202:25
   6: <gpui::app::AppCell>::borrow_mut
             at ./crates/gpui/src/app.rs:88:28
   7: <gpui::app::App>::new_app::{closure#2}
             at ./crates/gpui/src/app.rs:749:39
   8: <alloc::boxed::Box<dyn core::ops::function::FnMut<(), Output = ()>> as core::ops::function::FnMut<()>>::call_mut
             at /Users/peter/.rustup/toolchains/1.93-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:2213:9
   9: gpui::platform::mac::platform::on_thermal_state_change
             at ./crates/gpui/src/platform/mac/platform.rs:1265:9
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: <unknown>
  17: <unknown>
  18: <unknown>
  19: <unknown>
  20: <unknown>
  21: <unknown>
  22: __pthread_wqthread
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

But this branch looks good.
Thanks for the quick fix @marcocondrache.

@marcocondrache
Copy link
Contributor Author

Superseded by #49189

@marcocondrache
Copy link
Contributor Author

Reopening this since #49189 doesn't fully fix the issue

@bennetbo
Copy link
Member

bennetbo commented Feb 16, 2026

Thank you for fixing it! Planning to cherry-pick #49189 and this PR soon

@bennetbo bennetbo merged commit 2c59293 into zed-industries:main Feb 16, 2026
47 checks passed
@marcocondrache
Copy link
Contributor Author

@bennetbo thank you so much! I don't think we need to cherry pick #49189 since it didn't fully fixed the issue. I think this PR is the only one necessary. See #49189 (comment)

Also the fix is necessary only for preview channel. It shouldn't be present on stable.

@bennetbo
Copy link
Member

/cherry-pick preview

github-actions bot pushed a commit that referenced this pull request Feb 16, 2026
Fixes
#45638 (comment)
Closes #49005

The issue was similar to the one we already had with the quit method
https://github.com/zed-industries/zed/blob/8249ef56187b966c33f6667d0d3a35d88d8f2dc0/crates/gpui/src/platform/mac/platform.rs#L491

@notpeter Could you please test this branch to confirm it resolves the
issue?

- [ ] Tests or screenshots needed?
- [x] Code Reviewed
- [ ] Manual QA

Release Notes:

- Fixed an issue where Zed would randomly crash on macOS intel
zed-zippy bot added a commit that referenced this pull request Feb 16, 2026
…-pick to preview) (#49248)

Cherry-pick of #49086 to preview

----
Fixes
#45638 (comment)
Closes #49005

The issue was similar to the one we already had with the quit method

https://github.com/zed-industries/zed/blob/8249ef56187b966c33f6667d0d3a35d88d8f2dc0/crates/gpui/src/platform/mac/platform.rs#L491

@notpeter Could you please test this branch to confirm it resolves the
issue?

- [ ] Tests or screenshots needed?
- [x] Code Reviewed
- [ ] Manual QA

Release Notes:

- Fixed an issue where Zed would randomly crash on macOS intel

Co-authored-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
bennetbo pushed a commit that referenced this pull request Feb 16, 2026
…ed" (#49251)

Reverts #49189
Reverts #49187

#49189 introduces a panic
(#49189 (comment),
#49181 (comment))
#49187 It's wrong since it leads to missing updates

The original crash should be fixed with #49086

cc: @bennetbo 

Release Notes:

- N/A
rtfeldman pushed a commit that referenced this pull request Feb 17, 2026
Fixes
#45638 (comment)
Closes #49005

The issue was similar to the one we already had with the quit method
https://github.com/zed-industries/zed/blob/8249ef56187b966c33f6667d0d3a35d88d8f2dc0/crates/gpui/src/platform/mac/platform.rs#L491

@notpeter Could you please test this branch to confirm it resolves the
issue?

- [ ] Tests or screenshots needed?
- [x] Code Reviewed
- [ ] Manual QA

Release Notes:

- Fixed an issue where Zed would randomly crash on macOS intel
rtfeldman pushed a commit that referenced this pull request Feb 17, 2026
…ed" (#49251)

Reverts #49189
Reverts #49187

#49189 introduces a panic
(#49189 (comment),
#49181 (comment))
#49187 It's wrong since it leads to missing updates

The original crash should be fixed with #49086

cc: @bennetbo 

Release Notes:

- N/A
Caio-Ze pushed a commit to Caio-Ze/postprod-ide that referenced this pull request Feb 21, 2026
…49086)

Fixes
zed-industries#45638 (comment)
Closes zed-industries#49005

The issue was similar to the one we already had with the quit method
https://github.com/zed-industries/zed/blob/8249ef56187b966c33f6667d0d3a35d88d8f2dc0/crates/gpui/src/platform/mac/platform.rs#L491

@notpeter Could you please test this branch to confirm it resolves the
issue?

- [ ] Tests or screenshots needed?
- [x] Code Reviewed
- [ ] Manual QA

Release Notes:

- Fixed an issue where Zed would randomly crash on macOS intel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement community champion Issues filed by our amazing community champions! 🫶

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zed crashes frequently

4 participants