Skip to content

Commit

Permalink
Fix panic in update_ime_position (#21510)
Browse files Browse the repository at this point in the history
This can call back into the app, so must be done when the platform lock
is not
held.

Release Notes:

- Fixes a (rare) panic when changing tab
  • Loading branch information
ConradIrwin authored Dec 4, 2024
1 parent 8f08787 commit e231321
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions crates/gpui/src/platform/mac/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,10 +1111,16 @@ impl PlatformWindow for MacWindow {
}

fn update_ime_position(&self, _bounds: Bounds<ScaledPixels>) {
unsafe {
let input_context: id = msg_send![class!(NSTextInputContext), currentInputContext];
let _: () = msg_send![input_context, invalidateCharacterCoordinates];
}
let executor = self.0.lock().executor.clone();
executor
.spawn(async move {
unsafe {
let input_context: id =
msg_send![class!(NSTextInputContext), currentInputContext];
let _: () = msg_send![input_context, invalidateCharacterCoordinates];
}
})
.detach()
}
}

Expand Down

0 comments on commit e231321

Please sign in to comment.