From 3a93ddce65e31b6a7be4779417096f7fbc4522c4 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Sun, 18 Dec 2022 18:17:00 +0300 Subject: [PATCH] Fix selector callback patching --- libs/ui/source/selector.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/ui/source/selector.cpp b/libs/ui/source/selector.cpp index 6041e11b..4fd965b1 100644 --- a/libs/ui/source/selector.cpp +++ b/libs/ui/source/selector.cpp @@ -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); }); };