Skip to content

Commit af63df8

Browse files
fhinkelMylesBorins
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 <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
1 parent 39cb687 commit af63df8

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
@@ -328,7 +328,7 @@ inline Environment::~Environment() {
328328
#if HAVE_INSPECTOR
329329
// Destroy inspector agent before erasing the context. The inspector
330330
// destructor depends on the context still being accessible.
331-
inspector_agent_.reset(nullptr);
331+
inspector_agent_.reset();
332332
#endif
333333

334334
context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex,

0 commit comments

Comments
 (0)