Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(editor): keep the OS memory pressure source out of audio cache unit tests

Richie McIlroyed99d1f57011
diff --git a/crates/editor/src/audio.rs b/crates/editor/src/audio.rs
index 4ce868e3a..278a40fa6 100644
--- a/crates/editor/src/audio.rs
+++ b/crates/editor/src/audio.rs
@@ -1834,7 +1834,14 @@ mod memory_pressure {
/// Installs one process-wide memory pressure source. It lives for the
/// rest of the process, so it is never released.
+ ///
+ /// Not installed in unit tests: a real pressure event on the host would
+ /// release the caches of every test running in the process at once.
+ /// Tests drive `on_memory_pressure` directly instead.
pub(super) fn watch() {
+ if cfg!(test) {
+ return;
+ }
static WATCH: std::sync::Once = std::sync::Once::new();
WATCH.call_once(|| unsafe {
let source = dispatch_source_create(