GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — buffer,n-api: fix double ArrayBuffer::Detach() during cleanup · nodejs/node@39a3cc1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • js_native_api_v8.cc
    • node_buffer.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/js_native_api_v8.cc‎

Copy file name to clipboardExpand all lines: src/js_native_api_v8.cc
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,12 @@ class ArrayBufferReference final : public Reference {
392392
inline void Finalize(bool is_env_teardown) override {
393393
if (is_env_teardown) {
394394
v8::HandleScope handle_scope(_env->isolate);
395-
v8::Local<v8::Value> ab = Get();
396-
CHECK(!ab.IsEmpty());
397-
CHECK(ab->IsArrayBuffer());
398-
ab.As<v8::ArrayBuffer>()->Detach();
395+
v8::Local<v8::Value> obj = Get();
396+
CHECK(!obj.IsEmpty());
397+
CHECK(obj->IsArrayBuffer());
398+
v8::Local<v8::ArrayBuffer> ab = obj.As<v8::ArrayBuffer>();
399+
if (ab->IsDetachable())
400+
ab->Detach();
399401
}
400402

401403
Reference::Finalize(is_env_teardown);
Collapse file

‎src/node_buffer.cc‎

Copy file name to clipboardExpand all lines: src/node_buffer.cc
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ void CallbackInfo::CleanupHook(void* data) {
151151
HandleScope handle_scope(self->env_->isolate());
152152
Local<ArrayBuffer> ab = self->persistent_.Get(self->env_->isolate());
153153
CHECK(!ab.IsEmpty());
154-
ab->Detach();
154+
if (ab->IsDetachable())
155+
ab->Detach();
155156
}
156157

157158
self->WeakCallback(self->env_->isolate());

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.