From 99b014ef7f6459e89be1cc2c52ecb6cdf5709b3d Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas Date: Tue, 21 Mar 2023 02:06:57 +0200 Subject: [PATCH] Fix segmentation fault when resizing canvas to a large size For some reason, cel_texture.texture.get_data() seemed to cause a segmentation fault, and then a crash, when the image size was large. Also added some extra static typing to the drag and drop methods, but they are unrelated to the crash. --- src/UI/Timeline/CelButton.gd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/UI/Timeline/CelButton.gd b/src/UI/Timeline/CelButton.gd index 2dcb595f5..4e7a77155 100644 --- a/src/UI/Timeline/CelButton.gd +++ b/src/UI/Timeline/CelButton.gd @@ -198,7 +198,7 @@ func _delete_cel_content() -> void: func _dim_checker() -> void: - var image := cel_texture.texture.get_data() + var image := cel.get_image() if image == null: return if image.is_empty() or image.is_invisible(): @@ -207,7 +207,7 @@ func _dim_checker() -> void: transparent_checker.self_modulate.a = 1.0 -func get_drag_data(_position) -> Array: +func get_drag_data(_position: Vector2) -> Array: var button := Button.new() button.rect_size = rect_size button.theme = Global.control.theme @@ -222,7 +222,7 @@ func get_drag_data(_position) -> Array: return ["Cel", frame, layer] -func can_drop_data(_pos, data) -> bool: +func can_drop_data(_pos: Vector2, data) -> bool: var project: Project = Global.current_project if typeof(data) == TYPE_ARRAY and data[0] == "Cel": var drag_frame = data[1] @@ -255,7 +255,7 @@ func can_drop_data(_pos, data) -> bool: return false -func drop_data(_pos, data) -> void: +func drop_data(_pos: Vector2, data) -> void: var drop_frame = data[1] var drop_layer = data[2] var project = Global.current_project