fix: avoid crash on update_cursor_icon (#7)

This commit is contained in:
elm
2025-08-19 20:20:22 +09:00
committed by GitHub
parent 6031e1c9d4
commit 38b2f09365
2 changed files with 7 additions and 8 deletions

View File

@@ -6,7 +6,8 @@
### Bug Fixes
- Fixed so that webview can detect pointers correctly even if it is not the root entity.
- Fixed so that the webview can detect pointers correctly even if it is not the root entity.
- Avoid a crash when updating the cursor icon
### Breaking Changes

View File

@@ -22,17 +22,15 @@ pub(crate) struct SystemCursorIconSender(Sender<SystemCursorIcon>);
pub(crate) struct SystemCursorIconReceiver(pub(crate) Receiver<SystemCursorIcon>);
fn update_cursor_icon(
par_commands: ParallelCommands,
mut commands: Commands,
cursor_icon_receiver: Res<SystemCursorIconReceiver>,
windows: Query<Entity>,
) {
while let Ok(cursor_icon) = cursor_icon_receiver.0.try_recv() {
windows.par_iter().for_each(|window| {
par_commands.command_scope(|mut commands| {
windows.iter().for_each(|window| {
commands
.entity(window)
.insert(CursorIcon::System(cursor_icon));
});
});
}
}