Skip to content

Commit

Permalink
src: use std::unique_ptr in base-object-inl.h
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
fhinkel authored and gibfahn committed Dec 20, 2017
1 parent 7ecaa1b commit e46f06c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/base-object-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ inline Environment* BaseObject::env() const {
template <typename Type>
inline void BaseObject::WeakCallback(
const v8::WeakCallbackInfo<Type>& data) {
Type* self = data.GetParameter();
std::unique_ptr<Type> self(data.GetParameter());
self->persistent().Reset();
delete self;
}


Expand Down
2 changes: 1 addition & 1 deletion src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ inline Environment::~Environment() {
#if HAVE_INSPECTOR
// Destroy inspector agent before erasing the context. The inspector
// destructor depends on the context still being accessible.
inspector_agent_.reset(nullptr);
inspector_agent_.reset();
#endif

context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex,
Expand Down

0 comments on commit e46f06c

Please sign in to comment.