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

LibGUI: Don't use Core::Object::add() to instantiate dialogs

Now that add() returns a WidgetType&, we can't rely on the parent of a
GUI::Dialog to still keep it alive after exec() returns. This happens
because exec() will call remove_from_parent() on itself before
returning.

And so we go back to the old idiom for creating a GUI::Dialog centered
above a specific window. Just call GUI::Dialog::construct(), passing
the "parent" window as the last parameter.
This commit is contained in:
Andreas Kling 2020-03-04 20:53:51 +01:00
parent dfa69b82b4
commit b29ff7b821
18 changed files with 43 additions and 43 deletions

View file

@ -74,8 +74,8 @@ Optional<String> FilePicker::get_save_filepath(const String& title, const String
return {};
}
FilePicker::FilePicker(Mode mode, const StringView& file_name, const StringView& path, Core::Object* parent)
: Dialog(parent)
FilePicker::FilePicker(Mode mode, const StringView& file_name, const StringView& path, Window* parent_window)
: Dialog(parent_window)
, m_model(FileSystemModel::create())
, m_mode(mode)
{