Skip to content

Commit f841fc6

Browse files
committed
src: use std::unique_ptr in base-object-inl.h
Drive-by fix: delete superflouos nullptr in ptr.reset(). PR-URL: #17079 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
1 parent ce6c7f5 commit f841fc6

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/base_object-inl.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ inline Environment* BaseObject::env() const {
6565
template <typename Type>
6666
inline void BaseObject::WeakCallback(
6767
const v8::WeakCallbackInfo<Type>& data) {
68-
Type* self = data.GetParameter();
68+
std::unique_ptr<Type> self(data.GetParameter());
6969
self->persistent().Reset();
70-
delete self;
7170
}
7271

7372

src/env-inl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ inline Environment::~Environment() {
329329
#if HAVE_INSPECTOR
330330
// Destroy inspector agent before erasing the context. The inspector
331331
// destructor depends on the context still being accessible.
332-
inspector_agent_.reset(nullptr);
332+
inspector_agent_.reset();
333333
#endif
334334

335335
context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex,

0 commit comments

Comments
 (0)