set_does_not_leak.gd 269 B

1234567891011
  1. # https://github.com/godotengine/godot/issues/90086
  2. class MyObj:
  3. var obj : WeakRef
  4. func test():
  5. var obj_1 = MyObj.new()
  6. var obj_2 = MyObj.new()
  7. Utils.check(obj_2.get_reference_count() == 1)
  8. obj_1.set(&"obj", obj_2)
  9. Utils.check(obj_2.get_reference_count() == 1)