You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-06 17:25:19 +00:00
[Core] Fix Variant::construct of Object
Variant type was not updated correctly causing leaks in ref-counted
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# https://github.com/godotengine/godot/issues/90086
|
||||
|
||||
class MyObj:
|
||||
var obj: WeakRef
|
||||
|
||||
func test():
|
||||
var obj_1 = MyObj.new()
|
||||
var obj_2 = MyObj.new()
|
||||
obj_1.obj = obj_2
|
||||
@@ -0,0 +1,6 @@
|
||||
GDTEST_RUNTIME_ERROR
|
||||
>> SCRIPT ERROR
|
||||
>> on function: test()
|
||||
>> runtime/errors/invalid_property_assignment.gd
|
||||
>> 9
|
||||
>> Invalid assignment of property or key 'obj' with value of type 'RefCounted (MyObj)' on a base object of type 'RefCounted (MyObj)'.
|
||||
@@ -0,0 +1,11 @@
|
||||
# https://github.com/godotengine/godot/issues/90086
|
||||
|
||||
class MyObj:
|
||||
var obj : WeakRef
|
||||
|
||||
func test():
|
||||
var obj_1 = MyObj.new()
|
||||
var obj_2 = MyObj.new()
|
||||
assert(obj_2.get_reference_count() == 1)
|
||||
obj_1.set(&"obj", obj_2)
|
||||
assert(obj_2.get_reference_count() == 1)
|
||||
@@ -0,0 +1 @@
|
||||
GDTEST_OK
|
||||
Reference in New Issue
Block a user