diff --git a/lib/internal/stream_base_commons.js b/lib/internal/stream_base_commons.js index c96da58ba1..917acd5c27 100644 --- a/lib/internal/stream_base_commons.js +++ b/lib/internal/stream_base_commons.js @@ -149,7 +149,7 @@ function afterWriteDispatched(self, req, err) { if (err !== 0) return self.destroy( errnoException(err, 'write', req.error), - req.callback()); + req.callback); if (!req.async && typeof req.callback === 'function') { req.callback(); diff --git a/src/base_object-inl.h b/src/base_object-inl.h index af0a7d707b..f35cd6734e 100644 --- a/src/base_object-inl.h +++ b/src/base_object-inl.h @@ -187,7 +187,7 @@ void BaseObject::decrease_refcount() { if (new_refcount == 0) { if (metadata->is_detached) { delete this; - } else if (metadata->wants_weak_jsobj) { + } else if (metadata->wants_weak_jsobj && !persistent_handle_.IsEmpty()) { MakeWeak(); } } @@ -195,7 +195,7 @@ void BaseObject::decrease_refcount() { void BaseObject::increase_refcount() { unsigned int prev_refcount = pointer_data()->strong_ptr_count++; - if (prev_refcount == 0) + if (prev_refcount == 0 && !persistent_handle_.IsEmpty()) persistent_handle_.ClearWeak(); } diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index 194704f9e1..f0aac8deda 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -11,14 +11,12 @@ const expected_keys = [ 'v8', 'zlib', 'nghttp2', - 'nghttp3', 'napi', 'llhttp' ]; if (common.hasCrypto) { expected_keys.push('openssl'); - expected_keys.push('ngtcp2'); } if (common.hasIntl) { @@ -28,6 +26,11 @@ if (common.hasIntl) { expected_keys.push('unicode'); } +if (common.hasQuic) { + expected_keys.push('ngtcp2'); + expected_keys.push('nghttp3'); +} + expected_keys.sort(); const actual_keys = Object.keys(process.versions).sort();