Add C conversion constructors to fix leak of default-constructed empty arrays

This commit is contained in:
sheepandshepherd
2019-12-04 21:12:59 +01:00
parent aba8766618
commit 66c671b59d
3 changed files with 12 additions and 4 deletions

View File

@@ -57,6 +57,11 @@ class Object;
class Array {
godot_array _godot_array;
friend class Variant;
inline explicit Array(const godot_array &other) {
_godot_array = other;
}
public:
Array();
Array(const Array &other);

View File

@@ -12,6 +12,11 @@ namespace godot {
class Dictionary {
godot_dictionary _godot_dictionary;
friend Variant::operator Dictionary() const;
inline explicit Dictionary(const godot_dictionary &other) {
_godot_dictionary = other;
}
public:
Dictionary();
Dictionary(const Dictionary &other);