Fixed crash when creating a new image and a layer had opacity less than 100%

Caused in CreateNewImage.gd, Global.current_layer = 0 should be under Global.canvas gets set to a new canvas, and after its _ready() method gets executed. The crash occurred when a layer above 0 had transparency less than 100, and a new image was created. _on_OpacitySlider_value_changed() in AnimationTimeline.gd was executed on the old canvas right before it was destroyed, while Global.layers had been cleared.

Also removed _on_OpacitySlider_value_changed() from Main.gd, it served no purpose there.
This commit is contained in:
OverloadedOrama 2020-04-11 05:36:51 +03:00
parent 2404798749
commit 3f1c81ac13
4 changed files with 10 additions and 15 deletions

View file

@ -60,7 +60,7 @@ func _ready() -> void:
if Global.config_cache.has_section_key("preferences", "pressure_sensitivity"):
Global.pressure_sensitivity_mode = Global.config_cache.get_value("preferences", "pressure_sensitivity")
sensitivity_option.selected = Global.pressure_sensitivity_mode
if Global.config_cache.has_section_key("preferences", "show_left_tool_icon"):
Global.show_left_tool_icon = Global.config_cache.get_value("preferences", "show_left_tool_icon")
left_tool_icon.pressed = Global.show_left_tool_icon
@ -409,7 +409,7 @@ func _on_DefaultBackground_color_changed(color: Color) -> void:
func _on_LeftIndicatorCheckbox_toggled(button_pressed : bool) -> void:
Global.left_square_indicator_visible = button_pressed
Global.left_square_indicator_visible = button_pressed
func _on_RightIndicatorCheckbox_toggled(button_pressed : bool) -> void: