Misc GPUI Entity<T> cleanups (#28996)

Found these while working on a `.rules` file which explains how GPUI
works.

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-04-17 17:29:19 -06:00 committed by GitHub
parent 676cc109a3
commit 7cf4926130
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 38 deletions

View file

@ -1222,7 +1222,7 @@ impl Window {
Evt: 'static,
{
let entity_id = entity.entity_id();
let entity = entity.downgrade();
let handle = entity.downgrade();
let window_handle = self.handle;
cx.new_subscription(
entity_id,
@ -1231,9 +1231,9 @@ impl Window {
Box::new(move |event, cx| {
window_handle
.update(cx, |_, window, cx| {
if let Some(handle) = Entity::<Emitter>::upgrade_from(&entity) {
if let Some(entity) = handle.upgrade() {
let event = event.downcast_ref().expect("invalid event type");
on_event(handle, event, window, cx);
on_event(entity, event, window, cx);
true
} else {
false