summaryrefslogtreecommitdiffstats
path: root/include/core/String.hpp
diff options
context:
space:
mode:
authorMarc Gilleron <marc.gilleron@gmail.com>2021-01-07 01:05:12 +0000
committerMarc Gilleron <marc.gilleron@gmail.com>2021-01-07 01:05:12 +0000
commitfb71edd45b2473bf0ac502c777a1850fb564087e (patch)
tree5d7a48365313cd54a2a763efa85728c36cf7ed86 /include/core/String.hpp
parent43828ebb3931b9117ad57f08cc457e052fdfd631 (diff)
downloadredot-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/String.hpp')
-rw-r--r--include/core/String.hpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/core/String.hpp b/include/core/String.hpp
index ebf161a..57e7eb7 100644
--- a/include/core/String.hpp
+++ b/include/core/String.hpp
@@ -29,7 +29,10 @@ public:
class String {
godot_string _godot_string;
- String(godot_string contents) :
+ friend class Dictionary;
+ friend class NodePath;
+ friend class Variant;
+ explicit inline String(godot_string contents) :
_godot_string(contents) {}
public: