diff options
author | Anna Henningsen <anna@addaleax.net> | 2021-06-12 00:43:48 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2021-06-14 14:30:50 +0300 |
commit | cd43073ce2c0c89498e37b4db6161a56fccd1fff (patch) | |
tree | 3ef9a3904e24baa7e858ae0620e429fc319ec6e9 /src/api | |
parent | 67d4a3f9bde27e4a4347d0bfa752be6cce33e6e9 (diff) |
src: fix multiple AddLinkedBinding() calls
Singly-linked lists are extended at their tail, not their head.
This fixes using more than 2 linked addons at a time.
PR-URL: https://github.com/nodejs/node/pull/39012
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/environment.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/api/environment.cc b/src/api/environment.cc index baf30654712..bd9de560d08 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -659,10 +659,10 @@ void AddLinkedBinding(Environment* env, const node_module& mod) { CHECK_NOT_NULL(env); Mutex::ScopedLock lock(env->extra_linked_bindings_mutex()); - node_module* prev_head = env->extra_linked_bindings_head(); + node_module* prev_tail = env->extra_linked_bindings_tail(); env->extra_linked_bindings()->push_back(mod); - if (prev_head != nullptr) - prev_head->nm_link = &env->extra_linked_bindings()->back(); + if (prev_tail != nullptr) + prev_tail->nm_link = &env->extra_linked_bindings()->back(); } void AddLinkedBinding(Environment* env, const napi_module& mod) { |