summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/Dialog.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-04 20:53:51 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-04 21:04:06 +0100
commitb29ff7b821ba4752a797d610c8f41d1a20f83d86 (patch)
treea1f848e7e7d3d7c97c05331cad8ea3f9037e5cb6 /Libraries/LibGUI/Dialog.cpp
parentdfa69b82b4233494e65af53bdd620ab33e0c043a (diff)
downloadserenity-b29ff7b821ba4752a797d610c8f41d1a20f83d86.zip
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.
Diffstat (limited to 'Libraries/LibGUI/Dialog.cpp')
-rw-r--r--Libraries/LibGUI/Dialog.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibGUI/Dialog.cpp b/Libraries/LibGUI/Dialog.cpp
index 9c4468b112..491fbfb8d0 100644
--- a/Libraries/LibGUI/Dialog.cpp
+++ b/Libraries/LibGUI/Dialog.cpp
@@ -31,8 +31,8 @@
namespace GUI {
-Dialog::Dialog(Core::Object* parent)
- : Window(parent)
+Dialog::Dialog(Window* parent_window)
+ : Window(parent_window)
{
set_modal(true);
}