src: use std::unique_ptr in base-object-inl.h
Drive-by fix: delete superflouos nullptr in ptr.reset(). PR-URL: https://github.com/nodejs/node/pull/17079 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
This commit is contained in:
parent
ce6c7f5b01
commit
f841fc63dd
@ -65,9 +65,8 @@ inline Environment* BaseObject::env() const {
|
|||||||
template <typename Type>
|
template <typename Type>
|
||||||
inline void BaseObject::WeakCallback(
|
inline void BaseObject::WeakCallback(
|
||||||
const v8::WeakCallbackInfo<Type>& data) {
|
const v8::WeakCallbackInfo<Type>& data) {
|
||||||
Type* self = data.GetParameter();
|
std::unique_ptr<Type> self(data.GetParameter());
|
||||||
self->persistent().Reset();
|
self->persistent().Reset();
|
||||||
delete self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ inline Environment::~Environment() {
|
|||||||
#if HAVE_INSPECTOR
|
#if HAVE_INSPECTOR
|
||||||
// Destroy inspector agent before erasing the context. The inspector
|
// Destroy inspector agent before erasing the context. The inspector
|
||||||
// destructor depends on the context still being accessible.
|
// destructor depends on the context still being accessible.
|
||||||
inspector_agent_.reset(nullptr);
|
inspector_agent_.reset();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex,
|
context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user