From 5c0b33f72e75281ce70c9866d90cc0f6a7121c22 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 7 May 2026 16:09:39 +0200 Subject: [PATCH] gpui_windows: Avoid process-wide priority elevation (#56050) We were incorrectly calling this with a thread handle, additionally changing the process priority here doesn't make sense, so just drop this. Release Notes: - N/A or Added/Fixed/Improved ... --------- Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com> --- crates/gpui_windows/src/dispatcher.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/crates/gpui_windows/src/dispatcher.rs b/crates/gpui_windows/src/dispatcher.rs index 60b9898cef3076fa64898ebcb7223616150bf01b..2b2bf402d2b147d33a014d887b936ed9ebbe5f79 100644 --- a/crates/gpui_windows/src/dispatcher.rs +++ b/crates/gpui_windows/src/dispatcher.rs @@ -13,10 +13,7 @@ use windows::{ Win32::{ Foundation::{LPARAM, WPARAM}, Media::{timeBeginPeriod, timeEndPeriod}, - System::Threading::{ - GetCurrentThread, HIGH_PRIORITY_CLASS, SetPriorityClass, SetThreadPriority, - THREAD_PRIORITY_TIME_CRITICAL, - }, + System::Threading::{GetCurrentThread, SetThreadPriority, THREAD_PRIORITY_TIME_CRITICAL}, UI::WindowsAndMessaging::PostMessageW, }, }; @@ -163,12 +160,7 @@ impl PlatformDispatcher for WindowsDispatcher { // SAFETY: always safe to call let thread_handle = unsafe { GetCurrentThread() }; - // SAFETY: thread_handle is a valid handle to a thread - unsafe { SetPriorityClass(thread_handle, HIGH_PRIORITY_CLASS) } - .context("thread priority class") - .log_err(); - - // SAFETY: thread_handle is a valid handle to a thread + // SAFETY: thread_handle is a valid handle to the current thread unsafe { SetThreadPriority(thread_handle, THREAD_PRIORITY_TIME_CRITICAL) } .context("thread priority") .log_err();