Skip to content

Commit e46f06c

Browse files
fhinkelgibfahn
authored andcommitted
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 7ecaa1b commit e46f06c

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
@@ -349,7 +349,7 @@ inline Environment::~Environment() {
349349
#if HAVE_INSPECTOR
350350
// Destroy inspector agent before erasing the context. The inspector
351351
// destructor depends on the context still being accessible.
352-
inspector_agent_.reset(nullptr);
352+
inspector_agent_.reset();
353353
#endif
354354

355355
context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex,

0 commit comments

Comments
 (0)