summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-06-05 23:04:31 +0430
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-06-06 00:27:30 +0430
commit51c2c69357963ecaffba522aa963a3eba1c3bc8e (patch)
tree0434ee07f49d5c0b1874f7477a82a7b084d2a790 /Userland/Libraries/LibGUI
parent104dc93220861081cb1a95210c7f8fe0ddcff3e6 (diff)
downloadserenity-51c2c69357963ecaffba522aa963a3eba1c3bc8e.zip
AK+Everywhere: Disallow constructing Functions from incompatible types
Previously, AK::Function would accept _any_ callable type, and try to call it when called, first with the given set of arguments, then with zero arguments, and if all of those failed, it would simply not call the function and **return a value-constructed Out type**. This lead to many, many, many hard to debug situations when someone forgot a `const` in their lambda argument types, and many cases of people taking zero arguments in their lambdas to ignore them. This commit reworks the Function interface to not include any such surprising behaviour, if your function instance is not callable with the declared argument set of the Function, it can simply not be assigned to that Function instance, end of story.
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r--Userland/Libraries/LibGUI/FilePicker.cpp2
-rw-r--r--Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp
index f914c97d35..5830155ee3 100644
--- a/Userland/Libraries/LibGUI/FilePicker.cpp
+++ b/Userland/Libraries/LibGUI/FilePicker.cpp
@@ -226,7 +226,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen
button.set_fixed_height(22);
button.set_checkable(true);
button.set_exclusive(true);
- button.on_click = [this, path] {
+ button.on_click = [this, path](auto) {
set_path(path);
};
m_common_location_buttons.append({ path, button });
diff --git a/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp b/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp
index 7a82f39c21..be4acdff42 100644
--- a/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp
+++ b/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp
@@ -47,13 +47,13 @@ WizardDialog::WizardDialog(Window* parent_window)
m_back_button = nav_container_widget.add<Button>("< Back");
m_back_button->set_fixed_width(75);
- m_back_button->on_click = [&]() {
+ m_back_button->on_click = [&](auto) {
pop_page();
};
m_next_button = nav_container_widget.add<Button>("Next >");
m_next_button->set_fixed_width(75);
- m_next_button->on_click = [&]() {
+ m_next_button->on_click = [&](auto) {
VERIFY(has_pages());
if (!current_page().can_go_next())
@@ -71,7 +71,7 @@ WizardDialog::WizardDialog(Window* parent_window)
m_cancel_button = nav_container_widget.add<Button>("Cancel");
m_cancel_button->set_fixed_width(75);
- m_cancel_button->on_click = [&]() {
+ m_cancel_button->on_click = [&](auto) {
handle_cancel();
};