Skip to content

Commit 0501f22

Browse files
authored
Merge pull request #110 from NuiCpp/fix/dangling-attribute-function
Fixed dangling reference to function.
2 parents 513c50e + ed36fe3 commit 0501f22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nui/include/nui/frontend/attributes/reference.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Nui::Attributes
1919
requires std::invocable<T, Nui::val&&>
2020
Attribute onMaterialize(T&& func) const
2121
{
22-
return operator=([&func](std::weak_ptr<Dom::BasicElement>&& element) {
22+
return operator=([func = std::forward<T>(func)](std::weak_ptr<Dom::BasicElement>&& element) {
2323
func(element.lock()->val());
2424
});
2525
}

0 commit comments

Comments
 (0)