From 9b25e03bec96551ff6caff8f29374949692a4343 Mon Sep 17 00:00:00 2001 From: xFrednet Date: Tue, 22 Oct 2024 15:07:20 +0200 Subject: [PATCH] Prototype: Correct LRC tracking for prototypes --- src/rt/objects/dyn_object.h | 5 ++++- tests/recursive_list.vpy | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rt/objects/dyn_object.h b/src/rt/objects/dyn_object.h index ac6e2b5..fed8b6c 100644 --- a/src/rt/objects/dyn_object.h +++ b/src/rt/objects/dyn_object.h @@ -183,7 +183,10 @@ namespace rt::objects } if (prototype != nullptr) - prototype->change_rc(1); + { + // prototype->change_rc(1); + add_reference(this, prototype); + } std::cout << "Allocate: " << this << std::endl; } diff --git a/tests/recursive_list.vpy b/tests/recursive_list.vpy index 8b9b03a..becc02d 100644 --- a/tests/recursive_list.vpy +++ b/tests/recursive_list.vpy @@ -37,7 +37,6 @@ region list value = "x" # Dyrona doesn't freeze shared objects automatically (yet) -# There is currently a bug, where the LRC gets incorrect, if "[String]" isn't frozen proto = value["__proto__"] freeze proto drop proto