mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:57:45 +00:00
CrashReporter: Don't crash when "Generating..." Window gets closed
This commit is contained in:
parent
1bc945860d
commit
fc2ed732df
1 changed files with 10 additions and 0 deletions
|
@ -41,19 +41,29 @@ struct TitleAndText {
|
||||||
static NonnullRefPtr<GUI::Window> create_progress_window()
|
static NonnullRefPtr<GUI::Window> create_progress_window()
|
||||||
{
|
{
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
|
|
||||||
window->set_title("CrashReporter");
|
window->set_title("CrashReporter");
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
window->resize(240, 64);
|
window->resize(240, 64);
|
||||||
window->center_on_screen();
|
window->center_on_screen();
|
||||||
|
|
||||||
auto& main_widget = window->set_main_widget<GUI::Widget>();
|
auto& main_widget = window->set_main_widget<GUI::Widget>();
|
||||||
main_widget.set_fill_with_background_color(true);
|
main_widget.set_fill_with_background_color(true);
|
||||||
main_widget.set_layout<GUI::VerticalBoxLayout>();
|
main_widget.set_layout<GUI::VerticalBoxLayout>();
|
||||||
|
|
||||||
auto& label = main_widget.add<GUI::Label>("Generating crash report...");
|
auto& label = main_widget.add<GUI::Label>("Generating crash report...");
|
||||||
label.set_fixed_height(30);
|
label.set_fixed_height(30);
|
||||||
|
|
||||||
auto& progressbar = main_widget.add<GUI::Progressbar>();
|
auto& progressbar = main_widget.add<GUI::Progressbar>();
|
||||||
progressbar.set_name("progressbar");
|
progressbar.set_name("progressbar");
|
||||||
progressbar.set_fixed_width(150);
|
progressbar.set_fixed_width(150);
|
||||||
progressbar.set_fixed_height(22);
|
progressbar.set_fixed_height(22);
|
||||||
|
|
||||||
|
window->on_close = [&]() {
|
||||||
|
if (progressbar.value() != progressbar.max())
|
||||||
|
exit(0);
|
||||||
|
};
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue