CrashReporter: Don't crash when "Generating..." Window gets closed

This commit is contained in:
sw1tchbl4d3 2021-10-03 12:49:45 +02:00 committed by Andreas Kling
parent 1bc945860d
commit fc2ed732df
Notes: sideshowbarker 2024-07-18 03:09:08 +09:00

View file

@ -41,19 +41,29 @@ struct TitleAndText {
static NonnullRefPtr<GUI::Window> create_progress_window()
{
auto window = GUI::Window::construct();
window->set_title("CrashReporter");
window->set_resizable(false);
window->resize(240, 64);
window->center_on_screen();
auto& main_widget = window->set_main_widget<GUI::Widget>();
main_widget.set_fill_with_background_color(true);
main_widget.set_layout<GUI::VerticalBoxLayout>();
auto& label = main_widget.add<GUI::Label>("Generating crash report...");
label.set_fixed_height(30);
auto& progressbar = main_widget.add<GUI::Progressbar>();
progressbar.set_name("progressbar");
progressbar.set_fixed_width(150);
progressbar.set_fixed_height(22);
window->on_close = [&]() {
if (progressbar.value() != progressbar.max())
exit(0);
};
return window;
}