diff --git a/.changeset/twenty-windows-add.md b/.changeset/twenty-windows-add.md new file mode 100644 index 0000000..f6a686f --- /dev/null +++ b/.changeset/twenty-windows-add.md @@ -0,0 +1,5 @@ +--- +"nxjs-runtime": patch +--- + +Copy buffer for `Application#icon` and `Application#nacp` diff --git a/source/ns.c b/source/ns.c index dc1e4ad..150807e 100644 --- a/source/ns.c +++ b/source/ns.c @@ -112,7 +112,7 @@ static JSValue nx_ns_app_nacp(JSContext *ctx, JSValueConst this_val, int argc, J { return JS_EXCEPTION; } - return JS_NewArrayBuffer(ctx, (uint8_t *)&app->data.nacp, sizeof(app->data.nacp), NULL, NULL, false); + return JS_NewArrayBufferCopy(ctx, (uint8_t *)&app->data.nacp, sizeof(app->data.nacp)); } static JSValue nx_ns_app_icon(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) @@ -126,7 +126,7 @@ static JSValue nx_ns_app_icon(JSContext *ctx, JSValueConst this_val, int argc, J { return JS_UNDEFINED; } - return JS_NewArrayBuffer(ctx, (uint8_t *)&app->data.icon, app->icon_size, NULL, NULL, false); + return JS_NewArrayBufferCopy(ctx, (uint8_t *)&app->data.icon, app->icon_size); } static JSValue nx_ns_app_name(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)