Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4145,7 +4145,7 @@ PODS:
- ReactCommon/turbomodule/core
- SocketRocket
- Yoga
- RNWorklets (0.7.2):
- RNWorklets (0.8.1):
- boost
- DoubleConversion
- fast_float
Expand All @@ -4172,10 +4172,11 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNWorklets/worklets (= 0.7.2)
- RNWorklets/apple (= 0.8.1)
- RNWorklets/common (= 0.8.1)
- SocketRocket
- Yoga
- RNWorklets/worklets (0.7.2):
- RNWorklets/apple (0.8.1):
- boost
- DoubleConversion
- fast_float
Expand All @@ -4202,10 +4203,9 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNWorklets/worklets/apple (= 0.7.2)
- SocketRocket
- Yoga
- RNWorklets/worklets/apple (0.7.2):
- RNWorklets/common (0.8.1):
- boost
- DoubleConversion
- fast_float
Expand Down Expand Up @@ -4939,7 +4939,7 @@ SPEC CHECKSUMS:
RNSentry: f73f4da92e4c20841ab16e1fa22fc289bc2f9f4e
RNShare: 1c1fde2c4134b9cf220ffebbd6df9c414036d382
RNSVG: 74eb75bd44d62ba9969941e80d8f9832971c681f
RNWorklets: b2d54014a57a29d3c5848283069360d982880e60
RNWorklets: 5f541537f3dc04db08a5fc64b5d20b2ba6a9735d
SDWebImage: 16309af6d214ba3f77a7c6f6fdda888cb313a50a
SDWebImageAVIFCoder: afe194a084e851f70228e4be35ef651df0fc5c57
SDWebImageSVGCoder: 15a300a97ec1c8ac958f009c02220ac0402e936c
Expand Down
41 changes: 19 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
"react-native-vision-camera": "^4.7.2",
"react-native-web": "0.21.2",
"react-native-webview": "13.16.0",
"react-native-worklets": "0.7.2",
"react-native-worklets": "0.8.1",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
"react-webcam": "^7.1.1",
Expand Down
2 changes: 1 addition & 1 deletion patches/react-native-worklets/details.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `react-native-worklets` patches

### [react-native-worklets+0.7.2+001+fix-app-crash-SerializableRemoteFunction.patch](react-native-worklets+0.7.2+001+fix-app-crash-SerializableRemoteFunction.patch)
### [react-native-worklets+0.8.1+001+fix-app-crash-SerializableRemoteFunction.patch](react-native-worklets+0.8.1+001+fix-app-crash-SerializableRemoteFunction.patch)

- Reason: Fixes SIGSEGV crash in `SerializableRemoteFunction` destructor caused by a data race on `globalMarkdownWorkletRuntime`. The fix replaces the stored `jsi::Value` function reference with an ID-based lookup via a `__remoteFunctionCache` map, avoiding the unsafe cross-thread `~jsi::Value()` call during runtime teardown.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/node_modules/react-native-worklets/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.cpp b/node_modules/react-native-worklets/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.cpp
index a7cb25ddf3..c6bd17a90d 100644
index 2d4e78a..b105c1d 100644
--- a/node_modules/react-native-worklets/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.cpp
+++ b/node_modules/react-native-worklets/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.cpp
@@ -321,8 +321,8 @@ jsi::Value JSIWorkletsModuleProxy::get(jsi::Runtime &rt, const jsi::PropNameID &
@@ -320,8 +320,8 @@ jsi::Value JSIWorkletsModuleProxy::get(jsi::Runtime &rt, const jsi::PropNameID &

if (name == "createSerializableFunction") {
return jsi::Function::createFromHostFunction(
Expand All @@ -14,10 +14,10 @@ index a7cb25ddf3..c6bd17a90d 100644
}

diff --git a/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/Serializable.cpp b/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/Serializable.cpp
index 67ff75a9a5..6f8a29055d 100644
index 62672f7..8a6a572 100644
--- a/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/Serializable.cpp
+++ b/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/Serializable.cpp
@@ -31,7 +31,7 @@ jsi::Value makeSerializableClone(
@@ -32,7 +32,7 @@ jsi::Value makeSerializableClone(
} else if (!object.getProperty(rt, "__init").isUndefined()) {
return makeSerializableInitializer(rt, object);
} else if (object.isFunction(rt)) {
Expand All @@ -26,22 +26,7 @@ index 67ff75a9a5..6f8a29055d 100644
} else if (object.isArray(rt)) {
if (shouldRetainRemote.isBool() && shouldRetainRemote.getBool()) {
serializable = std::make_shared<RetainingSerializable<SerializableArray>>(rt, object.asArray(rt));
@@ -121,12 +121,12 @@ jsi::Value makeSerializableInitializer(jsi::Runtime &rt, const jsi::Object &init
return SerializableJSRef::newNativeStateObject(rt, serializable);
}

-jsi::Value makeSerializableFunction(jsi::Runtime &rt, jsi::Function function) {
+jsi::Value makeSerializableFunction(jsi::Runtime &rt, jsi::Function function, double id) {
std::shared_ptr<Serializable> serializable;
if (function.isHostFunction(rt)) {
serializable = std::make_shared<SerializableHostFunction>(rt, std::move(function));
} else {
- serializable = std::make_shared<SerializableRemoteFunction>(rt, std::move(function));
+ serializable = std::make_shared<SerializableRemoteFunction>(rt, id);
}
return SerializableJSRef::newNativeStateObject(rt, serializable);
}
@@ -369,7 +369,11 @@ jsi::Value SerializableImport::toJSValue(jsi::Runtime &rt) {
@@ -240,7 +240,11 @@ jsi::Value SerializableImport::toJSValue(jsi::Runtime &rt) {

jsi::Value SerializableRemoteFunction::toJSValue(jsi::Runtime &rt) {
if (&rt == runtime_) {
Expand All @@ -55,19 +40,10 @@ index 67ff75a9a5..6f8a29055d 100644
#ifndef NDEBUG
return getValueUnpacker(rt).call(
diff --git a/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/Serializable.h b/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/Serializable.h
index 771b6be96c..5e60aa7e11 100644
index 1c20158..85ddc43 100644
--- a/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/Serializable.h
+++ b/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/Serializable.h
@@ -162,7 +162,7 @@ jsi::Value makeSerializableSet(jsi::Runtime &rt, const jsi::Array &values);

jsi::Value makeSerializableInitializer(jsi::Runtime &rt, const jsi::Object &initializerObject);

-jsi::Value makeSerializableFunction(jsi::Runtime &rt, jsi::Function function);
+jsi::Value makeSerializableFunction(jsi::Runtime &rt, jsi::Function function, double id);

jsi::Value makeSerializableWorklet(jsi::Runtime &rt, const jsi::Object &object, const bool &shouldRetainRemote);

@@ -295,21 +295,19 @@ class SerializableRemoteFunction : public Serializable,
@@ -233,21 +233,19 @@ class SerializableRemoteFunction : public Serializable,
#ifndef NDEBUG
const std::string name_;
#endif
Expand All @@ -94,11 +70,43 @@ index 771b6be96c..5e60aa7e11 100644

jsi::Value toJSValue(jsi::Runtime &rt) override;
};
diff --git a/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/SerializableFactory.cpp b/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/SerializableFactory.cpp
index 5dee2b6..748478b 100644
--- a/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/SerializableFactory.cpp
+++ b/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/SerializableFactory.cpp
@@ -51,12 +51,12 @@ jsi::Value makeSerializableInitializer(jsi::Runtime &rt, const jsi::Object &init
return SerializableJSRef::newNativeStateObject(rt, serializable);
}

-jsi::Value makeSerializableFunction(jsi::Runtime &rt, jsi::Function function) {
+jsi::Value makeSerializableFunction(jsi::Runtime &rt, jsi::Function function, double id) {
std::shared_ptr<Serializable> serializable;
if (function.isHostFunction(rt)) {
serializable = std::make_shared<SerializableHostFunction>(rt, std::move(function));
} else {
- serializable = std::make_shared<SerializableRemoteFunction>(rt, std::move(function));
+ serializable = std::make_shared<SerializableRemoteFunction>(rt, id);
}
return SerializableJSRef::newNativeStateObject(rt, serializable);
}
diff --git a/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/SerializableFactory.h b/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/SerializableFactory.h
index a8bf711..91c40ff 100644
--- a/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/SerializableFactory.h
+++ b/node_modules/react-native-worklets/Common/cpp/worklets/SharedItems/SerializableFactory.h
@@ -43,7 +43,7 @@ jsi::Value makeSerializableSet(jsi::Runtime &rt, const jsi::Array &values);

jsi::Value makeSerializableInitializer(jsi::Runtime &rt, const jsi::Object &initializerObject);

-jsi::Value makeSerializableFunction(jsi::Runtime &rt, jsi::Function function);
+jsi::Value makeSerializableFunction(jsi::Runtime &rt, jsi::Function function, double id);

jsi::Value makeSerializableWorklet(jsi::Runtime &rt, const jsi::Object &object, const bool &shouldRetainRemote);

diff --git a/node_modules/react-native-worklets/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp b/node_modules/react-native-worklets/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp
index d64c04647e..6d5b604d3a 100644
index 914811d..b2b8020 100644
--- a/node_modules/react-native-worklets/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp
+++ b/node_modules/react-native-worklets/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp
@@ -141,7 +141,7 @@ void WorkletRuntimeDecorator::decorate(
@@ -197,7 +197,7 @@ void WorkletRuntimeDecorator::decorate(
});

jsi_utils::installJsiFunction(rt, "_createSerializableFunction", [](jsi::Runtime &rt, const jsi::Value &value) {
Expand All @@ -108,10 +116,10 @@ index d64c04647e..6d5b604d3a 100644

jsi_utils::installJsiFunction(rt, "_createSerializableSynchronizable", [](jsi::Runtime &rt, const jsi::Value &value) {
diff --git a/node_modules/react-native-worklets/src/WorkletsModule/NativeWorklets.native.ts b/node_modules/react-native-worklets/src/WorkletsModule/NativeWorklets.native.ts
index 9a12fada57..ada9bf467e 100644
index e9ac98b..3297997 100644
--- a/node_modules/react-native-worklets/src/WorkletsModule/NativeWorklets.native.ts
+++ b/node_modules/react-native-worklets/src/WorkletsModule/NativeWorklets.native.ts
@@ -140,9 +140,10 @@ See https://docs.swmansion.com/react-native-worklets/docs/guides/troubleshooting
@@ -146,9 +146,11 @@ See https://docs.swmansion.com/react-native-worklets/docs/guides/troubleshooting
}

createSerializableFunction<TArgs extends unknown[], TReturn>(
Expand All @@ -122,11 +130,12 @@ index 9a12fada57..ada9bf467e 100644
+ id: number
+ ): SerializableRef<TReturn> {
+ return this.#workletsModuleProxy.createSerializableFunction(func, id);
+
}

createSerializableWorklet(worklet: object, shouldPersistRemote: boolean) {
diff --git a/node_modules/react-native-worklets/src/WorkletsModule/workletsModuleProxy.ts b/node_modules/react-native-worklets/src/WorkletsModule/workletsModuleProxy.ts
index b7d9fb2f11..c9bfd6dca1 100644
index 7781c76..02ff8fc 100644
--- a/node_modules/react-native-worklets/src/WorkletsModule/workletsModuleProxy.ts
+++ b/node_modules/react-native-worklets/src/WorkletsModule/workletsModuleProxy.ts
@@ -61,7 +61,8 @@ export interface WorkletsModuleProxy {
Expand All @@ -140,14 +149,14 @@ index b7d9fb2f11..c9bfd6dca1 100644

createSerializableWorklet(
diff --git a/node_modules/react-native-worklets/src/memory/serializable.native.ts b/node_modules/react-native-worklets/src/memory/serializable.native.ts
index 1b5f579011..fb82e3127e 100644
index a48d2fd..58d93bb 100644
--- a/node_modules/react-native-worklets/src/memory/serializable.native.ts
+++ b/node_modules/react-native-worklets/src/memory/serializable.native.ts
@@ -428,10 +428,18 @@ function cloneArray<T extends unknown[]>(
@@ -433,10 +433,19 @@ function cloneArray<T extends unknown[]>(
return clone;
}

+// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
+// eslint-disable-next-line @typescript-eslint/o-unsafe-function-type
+const remoteFunctionCache = new Map<number, Function>();
+// @ts-expect-error it's ok
+globalThis.__remoteFunctionCache = remoteFunctionCache;
Expand All @@ -160,6 +169,7 @@ index 1b5f579011..fb82e3127e 100644
+ const currentIndex = index++;
+ remoteFunctionCache.set(currentIndex, value);
+ const clone = WorkletsModule.createSerializableFunction(value, currentIndex);
+
serializableMappingCache.set(value, clone);
serializableMappingCache.set(clone);

Loading