mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
Fix crash in egui_extras::FileLoader after forget_image (#6995)
This pull request modifies the `BytesLoader` implementation for `FileLoader` in `crates/egui_extras/src/loaders/file_loader.rs` to improve thread safety and handle unexpected states more gracefully. ### Changes to thread safety and state handling: * Updated the cache logic to check if the `uri` exists in the cache before inserting the result. If the `uri` is not found, a log message is added to indicate the loading was canceled. This change prevents overwriting cache entries unexpectedly. * Closes <https://github.com/emilk/egui/issues/6755> * [x] I have followed the instructions in the PR template
This commit is contained in:
@@ -3446,6 +3446,7 @@ impl Context {
|
||||
/// Release all memory and textures related to the given image URI.
|
||||
///
|
||||
/// If you attempt to load the image again, it will be reloaded from scratch.
|
||||
/// Also this cancels any ongoing loading of the image.
|
||||
pub fn forget_image(&self, uri: &str) {
|
||||
use load::BytesLoader as _;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user