Skip to content

Commit

Permalink
[#90] fix(DaedalusVm): fix dangling reference in `register_default_ex…
Browse files Browse the repository at this point in the history
…ternal`

Capturing a temporary to a callback handler in the wrapper causes a dangling reference if `callback` is not held anywhere else.
  • Loading branch information
lmichaelis committed Apr 17, 2024
1 parent 16267f5 commit 713480b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DaedalusVm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ namespace zenkit {
}

void DaedalusVm::register_default_external(std::function<void(std::string_view)> const& callback) {
this->register_default_external([&callback](DaedalusSymbol const& sym) { callback(sym.name()); });
this->register_default_external([callback](DaedalusSymbol const& sym) { callback(sym.name()); });
}

void DaedalusVm::register_default_external(std::function<void(DaedalusSymbol const&)> const& callback) {
Expand Down

0 comments on commit 713480b

Please sign in to comment.