Skip to content

Commit

Permalink
Fix another crash-on-exit ref counting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Oct 7, 2023
1 parent ee42c2a commit 254d799
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/violet-candles-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nxjs-runtime': patch
---

Fix another crash-on-exit ref counting issue
3 changes: 1 addition & 2 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ int main(int argc, char *argv[])
/* The internal `$` object contains native functions that are wrapped in the JS runtime */
JSValue global_obj = JS_GetGlobalObject(ctx);
JSValue init_obj = JS_NewObject(ctx);
JS_SetPropertyStr(ctx, global_obj, "$", init_obj);
nx_init_wasm(ctx, init_obj);
JS_SetPropertyStr(ctx, global_obj, "$", init_obj);

// First try the `main.js` file on the RomFS
size_t user_code_size;
Expand Down Expand Up @@ -681,7 +681,6 @@ int main(int argc, char *argv[])
JS_FreeValue(ctx, dispatch_event_func);
JS_FreeValue(ctx, native_obj);
JS_FreeValue(ctx, switch_obj);
JS_FreeValue(ctx, init_obj);
JS_FreeValue(ctx, global_obj);

JS_FreeContext(ctx);
Expand Down

0 comments on commit 254d799

Please sign in to comment.