Skip to content

Commit 2e28107

Browse files
committed
address reviews
1 parent 0766b26 commit 2e28107

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/main_emscripten_kernel.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
template <class interpreter_type>
1919
static interpreter_type* builder_with_args(emscripten::val js_args)
2020
{
21+
// TODO: Refactor interpreter constructor to avoid static args-to-argv conversion.
2122
static std::vector<std::string> args = emscripten::vecFromJSArray<std::string>(js_args);
2223
static std::vector<const char*> argv_vec;
2324

@@ -29,7 +30,10 @@ static interpreter_type* builder_with_args(emscripten::val js_args)
2930
int argc = static_cast<int>(argv_vec.size());
3031
char** argv = const_cast<char**>(argv_vec.data());
3132

32-
return new interpreter_type(argc, argv);
33+
auto* res = new interpreter_type(argc, argv);
34+
argv_vec.clear();
35+
args.clear();
36+
return res;
3337
}
3438

3539
EMSCRIPTEN_BINDINGS(my_module)

src/xinterpreter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "xinput.hpp"
1919
#include "xinspect.hpp"
2020
#include "xmagics/os.hpp"
21+
#include <iostream>
2122
#ifndef EMSCRIPTEN
2223
#include "xmagics/xassist.hpp"
2324
#endif

0 commit comments

Comments
 (0)