diff options
author | Marc Gilleron <marc.gilleron@gmail.com> | 2021-01-07 01:05:12 +0000 |
---|---|---|
committer | Marc Gilleron <marc.gilleron@gmail.com> | 2021-01-07 01:05:12 +0000 |
commit | fb71edd45b2473bf0ac502c777a1850fb564087e (patch) | |
tree | 5d7a48365313cd54a2a763efa85728c36cf7ed86 /include/core/Array.hpp | |
parent | 43828ebb3931b9117ad57f08cc457e052fdfd631 (diff) | |
download | redot-cpp-fb71edd45b2473bf0ac502c777a1850fb564087e.tar.gz |
Fix container and string leaks
Some functions return a new instance of such containers,
but instead we made a copy of them, without taking ownership of the
original created by the function.
Now we use a specific constructor taking ownership on the godot_* struct.
Diffstat (limited to 'include/core/Array.hpp')
-rw-r--r-- | include/core/Array.hpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/core/Array.hpp b/include/core/Array.hpp index 3d13914..84dc012 100644 --- a/include/core/Array.hpp +++ b/include/core/Array.hpp @@ -58,6 +58,8 @@ class Array { godot_array _godot_array; friend class Variant; + friend class Dictionary; + friend class String; inline explicit Array(const godot_array &other) { _godot_array = other; } @@ -88,7 +90,7 @@ public: Variant &operator[](const int idx); - Variant operator[](const int idx) const; + const Variant &operator[](const int idx) const; void append(const Variant &v); |