8000 Assertion in egui_extras::FileLoader::load triggers when Context::forget_image is called while image is loading · Issue #6755 · emilk/egui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Assertion in egui_extras::FileLoader::load triggers when Context::forget_image is called while image is loading #6755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
luveti opened this issue Apr 16, 2025 · 1 comment · May be fixed by #6995

Comments

@luveti
Copy link
luveti commented Apr 16, 2025

The following:

assert!(matches!(prev, Some(Poll::Pending)), "unexpected state");

Doesn't take into account that the user may want to forget the image before it's loaded. Here:

let _ = self.cache.lock().remove(uri);

or here:

self.cache.lock().clear();

The following would be a better alternative (untested):

let mut cache = cache.lock();
if cache.contains(&uri) {
  cache.insert(uri.clone(), Poll::Ready(result));
  ctx.request_repaint();
  log::trace!("finished loading {uri:?}");
}
else {
  log::trace!("cancelled loading {uri:?}");
}

This assert was recently added by @bircni and @lucasmerlin in 58b2ac8. It's possible similar assertions were added in other loaders.

@lucasmerlin
Copy link
Collaborator

Good catch! Would you mind opening a PR? 🙏 Your fix looks correct

@bircni bircni linked a pull request May 3, 2025 that will close this issue
5484 1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0