Fix selector callback patching

This commit is contained in:
Nikita Lisitsa 2022-12-18 18:17:00 +03:00
parent d5fdb2a7c5
commit 3a93ddce65

View file

@ -272,10 +272,11 @@ namespace psemek::ui
};
auto patch_callback = [&](struct selector * target){
target->on_selected([close, cb = target->on_selected()](std::size_t index){
target->on_selected([target, close, cb = target->on_selected()](std::size_t index){
close();
if (cb)
cb(index);
target->on_selected(cb);
});
};