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 <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
  • Loading branch information
fhinkel committed Nov 19, 2017
1 parent ce6c7f5 commit f841fc6
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 @@ -329,7 +329,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 f841fc6

Please sign in to comment.