Skip to content

Commit

Permalink
src: disallow copying, double close of scopes
Browse files Browse the repository at this point in the history
PR-URL: #566
Reviewed-By: NickNaso <nicoladelgobbo@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
  • Loading branch information
legendecas authored and mhdawson committed Oct 23, 2019
1 parent ce139a0 commit 34c11cf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions napi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,10 @@ namespace Napi {
explicit HandleScope(Napi::Env env);
~HandleScope();

// Disallow copying to prevent double close of napi_handle_scope
HandleScope(HandleScope const &) = delete;
void operator=(HandleScope const &) = delete;

operator napi_handle_scope() const;

Napi::Env Env() const;
Expand All @@ -1744,6 +1748,10 @@ namespace Napi {
explicit EscapableHandleScope(Napi::Env env);
~EscapableHandleScope();

// Disallow copying to prevent double close of napi_escapable_handle_scope
EscapableHandleScope(EscapableHandleScope const &) = delete;
void operator=(EscapableHandleScope const &) = delete;

operator napi_escapable_handle_scope() const;

Napi::Env Env() const;
Expand All @@ -1761,6 +1769,10 @@ namespace Napi {
CallbackScope(napi_env env, napi_async_context context);
virtual ~CallbackScope();

// Disallow copying to prevent double close of napi_callback_scope
CallbackScope(CallbackScope const &) = delete;
void operator=(CallbackScope const &) = delete;

operator napi_callback_scope() const;

Napi::Env Env() const;
Expand Down

0 comments on commit 34c11cf

Please sign in to comment.