1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

GFilePicker: Fix crash in get_save_filepath()

Oops, don't create GFilePickers on the stack! Spotted by Sergey ^)
This commit is contained in:
Andreas Kling 2019-10-06 21:01:03 +02:00
parent 3bee9d3d3c
commit 03725c6135

View file

@ -30,10 +30,10 @@ Optional<String> GFilePicker::get_open_filepath()
Optional<String> GFilePicker::get_save_filepath(const String& title, const String& extension)
{
GFilePicker picker(Mode::Save, String::format("%s.%s", title.characters(), extension.characters()));
auto picker = GFilePicker::construct(Mode::Save, String::format("%s.%s", title.characters(), extension.characters()));
if (picker.exec() == GDialog::ExecOK) {
String file_path = picker.selected_file().string();
if (picker->exec() == GDialog::ExecOK) {
String file_path = picker->selected_file().string();
if (file_path.is_null())
return {};