fix: load image synchronously if no callback is set
Some checks failed
Audit / vulnerabilities (push) Has been cancelled
Check / wasm (push) Has been cancelled
Check / widget (push) Has been cancelled
Document / all (push) Has been cancelled
Format / all (push) Has been cancelled
Lint / all (push) Has been cancelled
Test / all (macOS-latest, 1.88) (push) Has been cancelled
Test / all (macOS-latest, beta) (push) Has been cancelled
Test / all (macOS-latest, stable) (push) Has been cancelled
Test / all (ubuntu-latest, 1.88) (push) Has been cancelled
Test / all (ubuntu-latest, beta) (push) Has been cancelled
Test / all (ubuntu-latest, stable) (push) Has been cancelled
Test / all (windows-latest, 1.88) (push) Has been cancelled
Test / all (windows-latest, beta) (push) Has been cancelled
Test / all (windows-latest, stable) (push) Has been cancelled

This commit is contained in:
Hojjat 2026-04-13 11:49:44 -06:00 committed by Michael Murphy
parent 044496f652
commit 78caabba7e

View file

@ -398,10 +398,16 @@ fn load_image<'a>(
// Load RGBA handles synchronously, since it's very cheap
cache.insert(handle, Memory::load(handle));
} else if !pending.contains_key(&handle.id()) {
let _ = pending.insert(handle.id(), Vec::from_iter(callback));
if callback.is_some() {
let _ = pending.insert(handle.id(), Vec::from_iter(callback));
#[cfg(not(target_arch = "wasm32"))]
worker.load(handle);
#[cfg(not(target_arch = "wasm32"))]
worker.load(handle);
} else {
// Synchronous fallback when no callback is provided,
// needed for one-shot renders like drag icon screenshots
cache.insert(handle, Memory::load(handle));
}
}
}