diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-21 20:32:31 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-21 20:32:31 +0200 |
commit | 31b38ed88f3db123c498379f4615d2dce1ded406 (patch) | |
tree | a64bc5a935482193470d443c5cdcd70ad96472d6 /Applications/FileManager | |
parent | defafd72bc771034d615d56fe3fc5f71a7f707e5 (diff) | |
download | serenity-31b38ed88f3db123c498379f4615d2dce1ded406.zip |
LibGUI: Don't create GMessageBox and GInputBox on the stack
We need to get rid of all instances of widgets-on-the-stack since that
will no longer work in the ref-counting world.
Diffstat (limited to 'Applications/FileManager')
-rw-r--r-- | Applications/FileManager/main.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp index 73b32c0441..14a3e2ad32 100644 --- a/Applications/FileManager/main.cpp +++ b/Applications/FileManager/main.cpp @@ -92,12 +92,12 @@ int main(int argc, char** argv) }); auto mkdir_action = GAction::create("New directory...", GraphicsBitmap::load_from_file("/res/icons/16x16/mkdir.png"), [&](const GAction&) { - GInputBox input_box("Enter name:", "New directory", window); - if (input_box.exec() == GInputBox::ExecOK && !input_box.text_value().is_empty()) { + auto input_box = GInputBox::construct("Enter name:", "New directory", window); + if (input_box->exec() == GInputBox::ExecOK && !input_box->text_value().is_empty()) { auto new_dir_path = canonicalized_path( String::format("%s/%s", directory_view->path().characters(), - input_box.text_value().characters())); + input_box->text_value().characters())); int rc = mkdir(new_dir_path.characters(), 0777); if (rc < 0) { GMessageBox::show(String::format("mkdir(\"%s\") failed: %s", new_dir_path.characters(), strerror(errno)), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window); @@ -216,13 +216,12 @@ int main(int argc, char** argv) } if (confirm == ConfirmBeforeDelete::Yes) { - GMessageBox box( + auto result = GMessageBox::show( message, "Confirm deletion", GMessageBox::Type::Warning, GMessageBox::InputType::OKCancel, window); - auto result = box.exec(); if (result == GMessageBox::ExecCancel) return; } |