From c539f9aa9e074c1a9064c3744b2fb37451ce5523 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Wed, 13 May 2026 10:27:03 +1000 Subject: [PATCH] Fixed refCount = 0 --- source/actor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/actor.c b/source/actor.c index 40bfc24..b5d6820 100644 --- a/source/actor.c +++ b/source/actor.c @@ -72,7 +72,7 @@ static void api_loadSprite(Toy_VM* vm) { } //insert into the table as an opaque - Toy_insertTable(&spriteTable, key, TOY_OPAQUE_FROM_POINTER(sprite)); + Toy_insertTable(&spriteTable, Toy_copyValue(&vm->memoryBucket, key), TOY_OPAQUE_FROM_POINTER(sprite)); Toy_freeValue(key); Toy_freeValue(file); @@ -339,7 +339,7 @@ void loadSprite(Toy_Bucket** bucketHandle, Toy_Value key, const char* fname, int sprite->texture = LoadTexture(fname); //insert into the table as an opaque - Toy_insertTable(&spriteTable, key, TOY_OPAQUE_FROM_POINTER(sprite)); + Toy_insertTable(&spriteTable, Toy_copyValue(bucketHandle, key), TOY_OPAQUE_FROM_POINTER(sprite)); } ActorData* spawnActorAt(Toy_Bucket** bucketHandle, Toy_Value key, int xpos, int ypos) {