diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-06-05 23:04:31 +0430 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-06-06 00:27:30 +0430 |
commit | 51c2c69357963ecaffba522aa963a3eba1c3bc8e (patch) | |
tree | 0434ee07f49d5c0b1874f7477a82a7b084d2a790 /Userland/Applications/FontEditor | |
parent | 104dc93220861081cb1a95210c7f8fe0ddcff3e6 (diff) | |
download | serenity-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/Applications/FontEditor')
-rw-r--r-- | Userland/Applications/FontEditor/FontEditor.cpp | 6 | ||||
-rw-r--r-- | Userland/Applications/FontEditor/NewFontDialog.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Applications/FontEditor/FontEditor.cpp b/Userland/Applications/FontEditor/FontEditor.cpp index 7aae6efb87..f66c58c59b 100644 --- a/Userland/Applications/FontEditor/FontEditor.cpp +++ b/Userland/Applications/FontEditor/FontEditor.cpp @@ -92,7 +92,7 @@ static RefPtr<GUI::Window> create_font_preview_window(FontEditorWidget& editor) auto& reload_button = textbox_button_container.add<GUI::Button>(); reload_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png")); reload_button.set_fixed_width(22); - reload_button.on_click = [&] { + reload_button.on_click = [&](auto) { static int i = 1; if (i >= s_pangram_count) i = 0; @@ -326,7 +326,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&& m_glyph_editor_scale_actions.add_action(*m_scale_fifteen_action); m_glyph_editor_scale_actions.set_exclusive(true); - move_glyph_button.on_click = [&] { + move_glyph_button.on_click = [&](auto) { if (move_glyph_button.is_checked()) m_glyph_editor_widget->set_mode(GlyphEditorWidget::Move); else @@ -407,7 +407,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&& did_modify_font(); }; - m_weight_combobox->on_change = [this]() { + m_weight_combobox->on_change = [this](auto&, auto&) { m_edited_font->set_weight(GUI::name_to_weight(m_weight_combobox->text())); did_modify_font(); }; diff --git a/Userland/Applications/FontEditor/NewFontDialog.cpp b/Userland/Applications/FontEditor/NewFontDialog.cpp index b15127b279..5ca7d12565 100644 --- a/Userland/Applications/FontEditor/NewFontDialog.cpp +++ b/Userland/Applications/FontEditor/NewFontDialog.cpp @@ -197,7 +197,7 @@ NewFontDialog::NewFontDialog(GUI::Window* parent_window) m_glyph_width_spinbox->on_change = [&](int value) { preview_editor.set_preview_size(value, m_glyph_height_spinbox->value()); - deferred_invoke([&] { + deferred_invoke([&](auto&) { m_glyph_editor_container->set_fixed_height(1 + preview_editor.height() + preview_editor.frame_thickness() * 2); }); }; @@ -205,7 +205,7 @@ NewFontDialog::NewFontDialog(GUI::Window* parent_window) preview_editor.set_preview_size(m_glyph_width_spinbox->value(), value); m_mean_line_spinbox->set_max(max(value - 2, 0)); m_baseline_spinbox->set_max(max(value - 2, 0)); - deferred_invoke([&] { + deferred_invoke([&](auto&) { m_glyph_editor_container->set_fixed_height(1 + preview_editor.height() + preview_editor.frame_thickness() * 2); }); }; |