Skip to content

Commit

Permalink
fix: Fix moving sharedFunction after first callback call
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Nov 20, 2024
1 parent 12276b8 commit d0052ec
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,12 @@ struct JSIConverter<std::function<ReturnType(Args...)>> final {
}

if constexpr (std::is_void_v<ResultingType>) {
dispatcher->runAsync([&runtime, sharedFunction = std::move(sharedFunction), ... args = std::move(args)]() {
callJSFunction(runtime, sharedFunction, args...);
});
dispatcher->runAsync(
[&runtime, sharedFunction, ... args = std::move(args)]() { callJSFunction(runtime, sharedFunction, args...); });
} else {
return dispatcher->runAsyncAwaitable<ResultingType>(
[&runtime, sharedFunction = std::move(sharedFunction), ... args = std::move(args)]() -> ResultingType {
return callJSFunction(runtime, sharedFunction, args...);
});
return dispatcher->runAsyncAwaitable<ResultingType>([&runtime, sharedFunction, ... args = std::move(args)]() -> ResultingType {
return callJSFunction(runtime, sharedFunction, args...);
});
}
};
}
Expand Down

0 comments on commit d0052ec

Please sign in to comment.