Skip to content

Commit bb52a43

Browse files
committed
fix: capture model and callInvoker by value in GlobalThreadPool detach
1 parent c82605b commit bb52a43

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/react-native-executorch/common/rnexecutorch/host_objects/ModelHostObject.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,9 @@ template <typename Model> class ModelHostObject : public JsiHostObject {
375375
// We need to dispatch a thread if we want the function to be
376376
// asynchronous. In this thread all accesses to jsi::Runtime need to
377377
// be done via the callInvoker.
378-
threads::GlobalThreadPool::detach([this, promise,
378+
threads::GlobalThreadPool::detach([model = this->model,
379+
callInvoker = this->callInvoker,
380+
promise,
379381
argsConverted =
380382
std::move(argsConverted)]() {
381383
try {

0 commit comments

Comments
 (0)