You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to disable the default icon used by eframe, the application panics. The following code uses the confirm exit example, with the difference it tries to disable the default icon:
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
use eframe::egui;
use eframe::egui::IconData;
fn main() -> Result<(), eframe::Error> {
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default().with_inner_size([320.0, 240.0]).with_icon(IconData::default()),
..Default::default()
};
eframe::run_native(
"Confirm exit",
options,
Box::new(|_cc| Box::<MyApp>::default()),
)
}
#[derive(Default)]
struct MyApp {
show_confirmation_dialog: bool,
allowed_to_close: bool,
}
impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
ui.heading("Try to close the window");
});
if ctx.input(|i| i.viewport().close_requested()) {
if self.allowed_to_close {
// do nothing - we will close
} else {
ctx.send_viewport_cmd(egui::ViewportCommand::CancelClose);
self.show_confirmation_dialog = true;
}
}
if self.show_confirmation_dialog {
egui::Window::new("Do you want to quit?")
.collapsible(false)
.resizable(false)
.show(ctx, |ui| {
ui.horizontal(|ui| {
if ui.button("No").clicked() {
self.show_confirmation_dialog = false;
self.allowed_to_close = false;
}
if ui.button("Yes").clicked() {
self.show_confirmation_dialog = false;
self.allowed_to_close = true;
ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close);
}
});
});
}
}
}
Note with_icon(IconData::default()) at the end of the ViewportBuilder creation. Here is the full stack trace of the error:
thread 'main' panicked at 'Invalid Icon Data!: OsError(Os { code: 87, kind: InvalidInput, message: "Parâmetro incorreto." })', C:\Users\myUsr\Desktop\egui\crates\egui-winit\src\lib.rs:1549:18
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library\std\src\panicking.rs:593
1: core::panicking::panic_fmt
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library\core\src\panicking.rs:67
2: core::result::unwrap_failed
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library\core\src\result.rs:1651
3: enum2$<core::result::Result<winit::icon::Icon,enum2$<winit::icon::BadIcon> > >::expect<winit::icon::Icon,enum2$<winit::icon::BadIcon> >
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be\library\core\src\result.rs:1033
4: egui_winit::create_winit_window_builder<enum2$<eframe::native::winit_integration::UserEvent> >
at .\crates\egui-winit\src\lib.rs:1548
5: eframe::native::glow_integration::GlutinWindowContext::new
at .\crates\eframe\src\native\glow_integration.rs:866
6: eframe::native::glow_integration::GlowWinitApp::create_glutin_windowed_context
at .\crates\eframe\src\native\glow_integration.rs:172
7: eframe::native::glow_integration::GlowWinitApp::init_run_state
at .\crates\eframe\src\native\glow_integration.rs:215
8: eframe::native::glow_integration::impl$1::on_event
at .\crates\eframe\src\native\glow_integration.rs:438
9: eframe::native::run::run_and_return::closure$0<eframe::native::glow_integration::GlowWinitApp>
at .\crates\eframe\src\native\run.rs:128
10: winit::platform_impl::platform::event_loop::impl$3::run_on_demand::closure$0<enum2$<eframe::native::winit_integration::UserEvent>,eframe::native::run::run_and_return::closure_env$0<eframe::native::glow_integration::GlowWinitApp> >
at C:\Users\myUsr\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winit-0.29.7\src\platform_impl\windows\event_loop.rs:236
11: alloc::boxed::impl$48::call_mut<tuple$<enum2$<winit::event::Event<enum2$<eframe::native::winit_integration::UserEvent> > > >,dyn$<core::ops::function::FnMut<tuple$<enum2$<winit::event::Event<enum2$<eframe::native::winit_integration::UserEvent> > > >,assoc
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be\library\alloc\src\boxed.rs:2000
12: winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure$0<enum2$<eframe::native::winit_integration::UserEvent> >
at C:\Users\myUsr\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winit-0.29.7\src\platform_impl\windows\event_loop\runner.rs:250
13: core::panic::unwind_safe::impl$23::call_once<tuple$<>,winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<enum2$<eframe::native::winit_integration::UserEvent> > >
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be\library\core\src\panic\unwind_safe.rs:271
14: std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<enum2$<eframe::native::winit_integration::UserEvent> > >,tuple$<> >
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be\library\std\src\panicking.rs:500
15: std::panicking::try<tuple$<>,core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<enum2$<eframe::native::winit_integration::UserEvent> > > >
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be\library\std\src\panicking.rs:464
16: std::panic::catch_unwind
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be\library\std\src\panic.rs:142
17: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<enum2$<eframe::native::winit_integration::UserEvent> >::catch_unwind<enum2$<eframe::native::winit_integration::UserEvent>,tuple$<>,winit::platform_impl::platform::event_loop::runner::impl
at C:\Users\myUsr\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winit-0.29.7\src\platform_impl\windows\event_loop\runner.rs:183
18: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<enum2$<eframe::native::winit_integration::UserEvent> >::call_new_events<enum2$<eframe::native::winit_integration::UserEvent> >
at C:\Users\myUsr\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winit-0.29.7\src\platform_impl\windows\event_loop\runner.rs:372
19: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<enum2$<eframe::native::winit_integration::UserEvent> >::move_state_to<enum2$<eframe::native::winit_integration::UserEvent> >
at C:\Users\myUsr\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winit-0.29.7\src\platform_impl\windows\event_loop\runner.rs:311
20: winit::platform_impl::platform::event_loop::EventLoop<enum2$<eframe::native::winit_integration::UserEvent> >::wait_and_dispatch_message<enum2$<eframe::native::winit_integration::UserEvent> >
at C:\Users\myUsr\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winit-0.29.7\src\platform_impl\windows\event_loop.rs:369
21: winit::platform_impl::platform::event_loop::EventLoop<enum2$<eframe::native::winit_integration::UserEvent> >::run_on_demand<enum2$<eframe::native::winit_integration::UserEvent>,eframe::native::run::run_and_return::closure_env$0<eframe::native::glow_integr
at C:\Users\myUsr\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winit-0.29.7\src\platform_impl\windows\event_loop.rs:241
22: winit::platform::run_on_demand::impl$0::run_on_demand<enum2$<eframe::native::winit_integration::UserEvent>,eframe::native::run::run_and_return::closure_env$0<eframe::native::glow_integration::GlowWinitApp> >
at C:\Users\myUsr\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winit-0.29.7\src\platform\run_on_demand.rs:80
23: eframe::native::run::run_and_return<eframe::native::glow_integration::GlowWinitApp>
at .\crates\eframe\src\native\run.rs:76
24: eframe::native::run::run_glow::closure$0
at .\crates\eframe\src\native\run.rs:390
25: eframe::native::run::with_event_loop::closure$0<enum2$<core::result::Result<tuple$<>,enum2$<eframe::Error> > >,eframe::native::run::run_glow::closure_env$0>
at .\crates\eframe\src\native\run.rs:58
26: std::thread::local::LocalKey<core::cell::RefCell<enum2$<core::option::Option<winit::event_loop::EventLoop<enum2$<eframe::native::winit_integration::UserEvent> > > > > >::try_with<core::cell::RefCell<enum2$<core::option::Option<winit::event_loop::EventLoop
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be\library\std\src\thread\local.rs:270
27: std::thread::local::LocalKey<core::cell::RefCell<enum2$<core::option::Option<winit::event_loop::EventLoop<enum2$<eframe::native::winit_integration::UserEvent> > > > > >::with<core::cell::RefCell<enum2$<core::option::Option<winit::event_loop::EventLoop<enu
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be\library\std\src\thread\local.rs:246
28: eframe::native::run::with_event_loop<enum2$<core::result::Result<tuple$<>,enum2$<eframe::Error> > >,eframe::native::run::run_glow::closure_env$0>
at .\crates\eframe\src\native\run.rs:48
29: eframe::native::run::run_glow
at .\crates\eframe\src\native\run.rs:388
30: eframe::run_native
at .\crates\eframe\src\lib.rs:260
31: confirm_exit::main
at .\examples\confirm_exit\src\main.rs:12
32: core::ops::function::FnOnce::call_once<enum2$<core::result::Result<tuple$<>,enum2$<eframe::Error> > > (*)(),tuple$<> >
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be\library\core\src\ops\function.rs:250
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: process didn't exit successfully: `target\debug\confirm_exit.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)
Describe the bug
When trying to disable the default icon used by eframe, the application panics. The following code uses the confirm exit example, with the difference it tries to disable the default icon:
Note with_icon(IconData::default()) at the end of the ViewportBuilder creation. Here is the full stack trace of the error:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The window created should not use any icon.
Desktop:
The text was updated successfully, but these errors were encountered: