Skip to content

Commit 7b44afb

Browse files
committed
relax safety check
1 parent 0b3aa39 commit 7b44afb

File tree

1 file changed

+1
-17
lines changed
  • crates/bevy_mod_scripting_core/src/bindings

1 file changed

+1
-17
lines changed

crates/bevy_mod_scripting_core/src/bindings/world.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -172,29 +172,13 @@ impl<'w> WorldAccessGuard<'w> {
172172

173173
/// Runs a closure within an isolated access scope, releasing leftover accesses, should only be used in a single-threaded context.
174174
///
175-
/// Will throw an error if the length of the accesses after the closure is run, is not the same as at the beginning, to prevent safety issues.
176-
///
177175
/// Safety:
178176
/// - The caller must ensure it's safe to release any potentially locked accesses.
179177
pub(crate) unsafe fn with_access_scope<O, F: FnOnce() -> O>(
180178
&self,
181179
f: F,
182180
) -> Result<O, InteropError> {
183-
let length_start = self.inner.accesses.count_accesses();
184-
let (o, length_end) = self.inner.accesses.with_scope(|| {
185-
let o = f();
186-
(o, self.inner.accesses.count_accesses())
187-
});
188-
// TODO: re-enable this when
189-
// if length_start != length_end {
190-
// return Err(InteropError::invalid_access_count(
191-
// length_end,
192-
// length_start,
193-
// "Component/Resource/Allocation locks (accesses) were not released correctly in an access scope",
194-
// ));
195-
// }
196-
197-
Ok(o)
181+
Ok(self.inner.accesses.with_scope(f))
198182
}
199183

200184
/// Purely debugging utility to list all accesses currently held.

0 commit comments

Comments
 (0)