Skip to content

Commit

Permalink
Print a warning for un-applied commands being dropped from a CommandQ…
Browse files Browse the repository at this point in the history
…ueue (#11146)

# Objective

- Fixes #11125 
## Solution

Add a warning for un-applied commands to the `drop` function.
  • Loading branch information
garychia authored Jan 3, 2024
1 parent 19f5222 commit b6da40c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/bevy_ecs/src/system/commands/command_queue.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::mem::MaybeUninit;

use bevy_ptr::{OwningPtr, Unaligned};
use bevy_utils::tracing::warn;

use super::Command;
use crate::world::World;
Expand Down Expand Up @@ -161,6 +162,9 @@ impl CommandQueue {

impl Drop for CommandQueue {
fn drop(&mut self) {
if !self.bytes.is_empty() {
warn!("CommandQueue has un-applied commands being dropped.");
}
self.apply_or_drop_queued(None);
}
}
Expand Down

0 comments on commit b6da40c

Please sign in to comment.