diff options
author | sheepandshepherd <sheepandshepherd@hotmail.com> | 2019-12-04 21:12:59 +0100 |
---|---|---|
committer | sheepandshepherd <sheepandshepherd@hotmail.com> | 2020-01-31 00:08:02 +0100 |
commit | 66c671b59dece97d523478cae7c602de6d423aa4 (patch) | |
tree | d2206102a8d43efeef21f3fe740ce3e36d4dbb6a /src/core/Variant.cpp | |
parent | aba8766618c6aa40c6f7b40b513e8e47cfa807f4 (diff) | |
download | redot-cpp-66c671b59dece97d523478cae7c602de6d423aa4.tar.gz |
Add C conversion constructors to fix leak of default-constructed empty arrays
Diffstat (limited to 'src/core/Variant.cpp')
-rw-r--r-- | src/core/Variant.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/core/Variant.cpp b/src/core/Variant.cpp index 4c5cfe6..86d2f91 100644 --- a/src/core/Variant.cpp +++ b/src/core/Variant.cpp @@ -261,14 +261,12 @@ Variant::operator RID() const { } Variant::operator Dictionary() const { - Dictionary ret; - *(godot_dictionary *)&ret = godot::api->godot_variant_as_dictionary(&_godot_variant); + Dictionary ret(godot::api->godot_variant_as_dictionary(&_godot_variant)); return ret; } Variant::operator Array() const { - Array ret; - *(godot_array *)&ret = godot::api->godot_variant_as_array(&_godot_variant); + Array ret(godot::api->godot_variant_as_array(&_godot_variant)); return ret; } |