Skip to content

Commit

Permalink
Merge pull request #77 from hpicgs/deini-fix
Browse files Browse the repository at this point in the history
Correctly deinitialize context
  • Loading branch information
msoechting committed Feb 21, 2018
2 parents 9db182d + 3b2f0c6 commit d16cf5c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4720,7 +4720,8 @@ int _StopEnv() {
context_scope = nullptr;

if (!context.IsEmpty()) {
delete *context;
// No need to delete the context value (delete *context),
// this is already done by deleting the context_scope above.
context.Clear();
}

Expand Down Expand Up @@ -4861,8 +4862,6 @@ void _StartEnv(int argc,
int v8_argc,
const char* const* v8_argv,
const bool allow_repl) {
std::cout << "Starting environment" << std::endl;

_environment->Start(argc, argv, v8_argc, v8_argv, v8_is_profiling);

const char* path = argc > 1 ? argv[1] : nullptr;
Expand Down Expand Up @@ -4940,8 +4939,9 @@ void Initialize(int argc, const char** argv, const bool allow_repl) {

int Deinitialize() {
// Empty event queue
Evaluate("process.exit();");
while (ProcessEvents()) { }
// TODO(cf): Investigate when this is really needed.
// Evaluate("process.exit();");
// while (ProcessEvents()) { }

auto exit_code = deinitialize::_StopEnv();

Expand Down

0 comments on commit d16cf5c

Please sign in to comment.