Quote from: texus on 22 August 2017, 18:47:05
You are passing the settings to the lambda by reference (because of the "&"), but settings is a local object. After the "menu.create(gui);" call, the settings object has been destroyed. When the button is pressed, you will be accessing an object that no longer exists.
But why it doesn't crash when i use only buttons? (For test i have deleted all the checkboxes and comboboxes from Settings::create). For example, one of buttons:
Code Select
guifactory.button(context, 20, 1.2, 2.5, 10, "guiexit", "Exit");
tgui::Button::Ptr exitbutton = context.get<tgui::Button>("Exit");
exitbutton->connect("pressed", [&]() {
mainmenu.create(context);
});
And can you give me advice how to properly pass TGUI context to other functions?