From ed36fe335c1df84fe7f0dc33678a00d119ee0cc4 Mon Sep 17 00:00:00 2001 From: Tim Ebbeke Date: Wed, 12 Jun 2024 23:21:53 +0200 Subject: [PATCH] Fixed dangling reference to function. --- nui/include/nui/frontend/attributes/reference.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nui/include/nui/frontend/attributes/reference.hpp b/nui/include/nui/frontend/attributes/reference.hpp index e3be62a6..70ee88e0 100644 --- a/nui/include/nui/frontend/attributes/reference.hpp +++ b/nui/include/nui/frontend/attributes/reference.hpp @@ -19,7 +19,7 @@ namespace Nui::Attributes requires std::invocable Attribute onMaterialize(T&& func) const { - return operator=([&func](std::weak_ptr&& element) { + return operator=([func = std::forward(func)](std::weak_ptr&& element) { func(element.lock()->val()); }); }