Skip to content

Commit 4c83b4e

Browse files
mrousavywcandillon
andauthored
fix: Rename Dispatcher global name to avoid conflicts with Nitro (#271)
* fix: Rename `Dispatcher` global name to avoid conflicts with Nitro Since WebGPU uses an early copy of Nitro (kinda like a fork), there are some conflicts that users will run into when they install WebGPU in an app that already has Nitro Modules installed (or other way around). An official full fix would be to migrate WebGPU to Nitro, not only for better maintenance, but also for better performance and stability. I really don't think the migration is a huge effort. For now, this PR fixes the name of the `Dispatcher` that is injected into global, as Nitro uses the same name and when one of the two Nitro versions downcasts the global into the specific C++ symbol, we have conflics since it's two different C++ symbols - it's either `nitro::margelo::Dispatcher` (the official one) or the WebGPU `margelo::Dispatcher`. It's essentially a race condition with no clear error log since its just a C++ pointer cast that fails (super hard to debug lol) Fixes #270 * Bump version from 0.2.9 to 0.2.10 --------- Co-authored-by: William Candillon <wcandillon@gmail.com>
1 parent 26236f2 commit 4c83b4e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

packages/webgpu/cpp/threading/Dispatcher.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace margelo {
1212

1313
namespace jsi = facebook::jsi;
1414

15-
static constexpr auto GLOBAL_DISPATCHER_HOLDER_NAME = "__nitroDispatcher";
15+
static constexpr auto GLOBAL_DISPATCHER_HOLDER_NAME = "__nitroDispatcher_WEBGPU_FORK";
1616

1717
std::unordered_map<jsi::Runtime *, std::weak_ptr<Dispatcher>>
1818
Dispatcher::_globalCache;

packages/webgpu/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-wgpu",
3-
"version": "0.2.9",
3+
"version": "0.2.10",
44
"description": "React Native WebGPU",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

0 commit comments

Comments
 (0)