1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Fix memory leak where the project remained referenced in BaseDraw even when its tab was closed

Another memory leak remains in Recorder.gd, where the first project forever remains referenced in memory, until the user changes the project from the option button. Perhaps we should remove that option button completely and always record the current project, that also sounds like the intended behavior to me.
This commit is contained in:
Emmanouil Papadeas 2024-11-03 03:36:37 +02:00
parent e2971a8fe9
commit 8beb79a33b
4 changed files with 8 additions and 3 deletions

View file

@ -273,6 +273,8 @@ func draw_tool(pos: Vector2i) -> void:
func draw_end(pos: Vector2i) -> void:
super.draw_end(pos)
_stroke_project = null
_stroke_images = []
_brush_size_dynamics = _brush_size
if Tools.dynamics_size != Tools.Dynamics.NONE:
_brush_size_dynamics = Tools.brush_size_min

View file

@ -92,8 +92,8 @@ func draw_move(pos_i: Vector2i) -> void:
func draw_end(pos: Vector2i) -> void:
pos = snap_position(pos)
super.draw_end(pos)
if _picking_color:
super.draw_end(pos)
return
if _draw_line:
@ -105,6 +105,7 @@ func draw_end(pos: Vector2i) -> void:
draw_fill_gap(_line_start, _line_end)
_draw_line = false
super.draw_end(pos)
commit_undo()
SteamManager.set_achievement("ACH_ERASE_PIXEL")
cursor_text = ""

View file

@ -164,8 +164,8 @@ func draw_move(pos_i: Vector2i) -> void:
func draw_end(pos: Vector2i) -> void:
pos = snap_position(pos)
super.draw_end(pos)
if _picking_color:
super.draw_end(pos)
return
if _draw_line:
@ -194,6 +194,7 @@ func draw_end(pos: Vector2i) -> void:
draw_tool(v)
_fill_inside_rect = Rect2i()
super.draw_end(pos)
commit_undo()
cursor_text = ""
update_random_image()

View file

@ -291,8 +291,8 @@ func draw_move(pos_i: Vector2i) -> void:
func draw_end(pos: Vector2i) -> void:
pos = snap_position(pos)
super.draw_end(pos)
if _picking_color:
super.draw_end(pos)
return
if _draw_line:
@ -304,6 +304,7 @@ func draw_end(pos: Vector2i) -> void:
draw_fill_gap(_line_start, _line_end)
_draw_line = false
super.draw_end(pos)
commit_undo()
cursor_text = ""
update_random_image()