wasmtime-c-api: Make wasm_table_set *not* take ownership of its reference

Same for `wasm_table_grow` and `wasm_table_new` and their `init` values.
This commit is contained in:
Nick Fitzgerald
2020-07-10 12:03:03 -07:00
parent d07fdca73a
commit 89603bc6b3
4 changed files with 22 additions and 26 deletions

View File

@@ -107,9 +107,9 @@ int main() {
assert(elem.kind == WASM_ANYREF);
ok = wasm_table_set(table, 3, elem.of.ref);
assert(ok);
elem.of.ref = NULL;
// `table[3]` should now be our `externref`.
wasm_ref_delete(elem.of.ref);
elem.of.ref = wasm_table_get(table, 3);
assert(elem.of.ref != NULL);
assert(wasm_ref_same(elem.of.ref, externref.of.ref));