mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:17:44 +00:00
Applications: Fix undefined behavior capturing non-static constexpr
This commit is contained in:
parent
7a538c1e39
commit
064cfd6cb7
2 changed files with 19 additions and 19 deletions
|
@ -24,6 +24,13 @@ struct Option {
|
|||
bool default_action;
|
||||
};
|
||||
|
||||
static constexpr Array<Option, 2> options = {
|
||||
{
|
||||
{ "ASCII String", OPTION_ASCII_STRING, true, true },
|
||||
{ "Hex value", OPTION_HEX_VALUE, true, false },
|
||||
}
|
||||
};
|
||||
|
||||
int FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& out_buffer, bool& find_all)
|
||||
{
|
||||
auto dialog = FindDialog::construct();
|
||||
|
@ -101,13 +108,6 @@ FindDialog::FindDialog()
|
|||
m_find_all_button = *main_widget.find_descendant_of_type_named<GUI::Button>("find_all_button");
|
||||
m_cancel_button = *main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
|
||||
|
||||
constexpr Array<Option, 2> options = {
|
||||
{
|
||||
{ "ASCII String", OPTION_ASCII_STRING, true, true },
|
||||
{ "Hex value", OPTION_HEX_VALUE, true, false },
|
||||
}
|
||||
};
|
||||
|
||||
auto& radio_container = *main_widget.find_descendant_of_type_named<GUI::Widget>("radio_container");
|
||||
for (size_t i = 0; i < options.size(); i++) {
|
||||
auto action = options[i];
|
||||
|
@ -115,7 +115,7 @@ FindDialog::FindDialog()
|
|||
radio.set_enabled(action.enabled);
|
||||
radio.set_text(action.title);
|
||||
|
||||
radio.on_checked = [this, i, &options](auto) {
|
||||
radio.on_checked = [this, i](auto) {
|
||||
m_selected_option = options[i].opt;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue