Fixed memory leak with String objects

The member _godot_string should never be straight out overwritten ever without
first destroying the underlying string object's memory. This change solves the
problem through the introduction of a new private constructor to create String
objects with a pre-existing godot_string handle.
This commit is contained in:
Daniel Rakos
2019-06-21 16:40:36 +02:00
parent c2f765e49c
commit 0939d0f6d1
2 changed files with 40 additions and 137 deletions

View File

@@ -29,6 +29,9 @@ public:
class String {
godot_string _godot_string;
String(godot_string contents) :
_godot_string(contents) {}
public:
String();
String(const char *contents);