Closed qarmin closed 4 years ago
Hello, thanks for reporting the issue. I wasn't aware that this would cause leaks. Should we try and find a workaround for this issue or should we just wait until it's fixed in Godot?
Workaround for now is to remove all info about types, if type of returned object or created variable is same as type of class e.g.
class rr
var qq : rr = null # will cause leak
var qq2 # no leak
func zz() -> rr: # leak
pass
func zz2(): # no leak
pass
For now this patch should remove leak
diff --git a/Scripts/Palette/Palette.gd b/Scripts/Palette/Palette.gd
index f8ece9a..60ca46d 100644
--- a/Scripts/Palette/Palette.gd
+++ b/Scripts/Palette/Palette.gd
@@ -72,8 +72,8 @@ func save_to_file(path : String) -> void:
file.store_string(_serialize())
file.close()
-func duplicate() -> Palette:
- var copy : Palette = get_script().new()
+func duplicate():
+ var copy = get_script().new()
copy.name = name
copy.comments = comments
copy.editable = editable
@@ -96,7 +96,7 @@ func _serialize() -> String:
return result
-func deserialize(input_string : String) -> Palette:
+func deserialize(input_string : String):
var result = get_script().new()
var result_json = JSON.parse(input_string)
@@ -120,8 +120,8 @@ func deserialize(input_string : String) -> Palette:
return result
-func load_from_file(path : String) -> Palette:
- var result : Palette = null
+func load_from_file(path : String):
+ var result = null
var file = File.new()
if file.file_exists(path):
diff --git a/Scripts/Palette/PaletteColor.gd b/Scripts/Palette/PaletteColor.gd
index 806f7fd..ef74967 100644
--- a/Scripts/Palette/PaletteColor.gd
+++ b/Scripts/Palette/PaletteColor.gd
@@ -29,7 +29,7 @@ func toDict() -> Dictionary:
}
return result
-func fromDict(input_dict : Dictionary) -> PaletteColor:
+func fromDict(input_dict : Dictionary):
var result = get_script().new()
result.data = input_dict.data
@@ -37,8 +37,8 @@ func fromDict(input_dict : Dictionary) -> PaletteColor:
return result
-func duplicate() -> PaletteColor:
- var copy : PaletteColor = get_script().new()
+func duplicate():
+ var copy = get_script().new()
copy.data = data
copy.name = name
- return copy
\ No newline at end of file
+ return copy
Pixelorama latest 0.61
When I open and close editor I have this errors
This is Godot issue - https://github.com/godotengine/godot/issues/30668 - but I think that create here an issue may accelerate the resolution of the problem.
The problem is with two files
Each file is named class(with class_name) which in one of its function returns an object of its own type PaletteColor.gd
and Palette.gd