Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: quick terminal CPU spikes #4055

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

dmehala
Copy link
Collaborator

@dmehala dmehala commented Dec 30, 2024

Description

The following code is causing an infinite loop that causes a CPU spikes until the quick terminal is displayed:

guard window.isVisible else {
// Weak window so that if the window changes or is destroyed we aren't holding a ref
DispatchQueue.main.async { [weak self] in self?.syncAppearance(config) }
return

Reproduce steps

  1. Open Ghostty.
  2. Open the Quick Terminal.
  3. Close the Quick Terminal.
  4. Reload the configuration (Ghostty > Reload Configuration or shift+cmd+,).
  5. Observe CPU spike.

Fix

Now, syncAppearance doesn't postpone the process until it can be consumed, and the appearance is synchronized once the animation is done and the quick terminal is visible.

Fixes #3998

@mitchellh mitchellh force-pushed the dmehala/fix-qt-cpu-spikes branch from a6f8c3b to 011c17d Compare December 30, 2024 15:24
@mitchellh mitchellh merged commit ff50b55 into ghostty-org:main Dec 30, 2024
21 checks passed
@github-actions github-actions bot added this to the 1.0.1 milestone Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

macOS: QuickTerminal under certain circumstances spins at 100% CPU
2 participants