-
Notifications
You must be signed in to change notification settings - Fork 2k
When an immediate viewport is displayed, the cache will return None. #5441
Copy link
Copy link
Open
Labels
bugSomething is brokenSomething is broken
Description
Describe the bug
Cache works well in general, but when you have an immediate viewport, it will return None.
To Reproduce
Steps to reproduce the behavior:
- add master branch to Cargo.toml.
egui = { git = "https://github.com/emilk/egui", branch = "master" }
eframe = { git = "https://github.com/emilk/egui", branch = "master" }
- run this code.
type MyPublisher = egui::cache::FramePublisher<String, u32>;
fn main() -> eframe::Result {
eframe::run_simple_native("Example", eframe::NativeOptions::default(), |ctx, _| {
let key = String::from("key");
let value = ctx.memory_mut(|m| m.caches.cache::<MyPublisher>().get(&key).copied());
println!("value: {value:?}");
ctx.memory_mut(|m| m.caches.cache::<MyPublisher>().set(key, 0));
// If I comment out the following code, everything will be fine.
ctx.show_viewport_immediate(
egui::ViewportId::from_hash_of("ExampleViewport"),
Default::default(),
|_, _| {},
);
})
}Expected behavior
Even if immediate viewport is displayed, the cache should work properly.
Desktop (please complete the following information):
- OS: Windows 11
- Version: 23H2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething is brokenSomething is broken