Skip to content

Commit b21d145

Browse files
zcbenzMyles Borins
authored and
Myles Borins
committed
src: add node::FreeEnvironment public API
Since debugger::Agent's interface is not exported, third party embedders will have linking errors if they call Environment's destructor directly. PR-URL: #3098 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 01b314d commit b21d145

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/node.cc

+7
Original file line numberDiff line numberDiff line change
@@ -3226,6 +3226,13 @@ void LoadEnvironment(Environment* env) {
32263226
f->Call(global, 1, &arg);
32273227
}
32283228

3229+
3230+
void FreeEnvironment(Environment* env) {
3231+
CHECK_NE(env, nullptr);
3232+
env->Dispose();
3233+
}
3234+
3235+
32293236
static void PrintHelp();
32303237

32313238
static bool ParseDebugOpt(const char* arg) {

src/node.h

+1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ NODE_EXTERN Environment* CreateEnvironment(v8::Isolate* isolate,
196196
int exec_argc,
197197
const char* const* exec_argv);
198198
NODE_EXTERN void LoadEnvironment(Environment* env);
199+
NODE_EXTERN void FreeEnvironment(Environment* env);
199200

200201
// NOTE: Calling this is the same as calling
201202
// CreateEnvironment() + LoadEnvironment() from above.

0 commit comments

Comments
 (0)