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
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:
parent
044496f652
commit
78caabba7e
1 changed files with 9 additions and 3 deletions
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue