mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Fixed crash on Linux with layer containers
When the user clicked on a layer container to change its name and then clicked away, the program crashed. This was because the name of the layer was changed (`Global.layers[i][0] = new_name`), and Global.layers_changed() was being called, which removed all of the layer container UI and re-created it. This is unneeded to happen when only the layer name changes, so I added a boolean to skip the execution of the method. Oddly enough, the crash was not happening on Windows (at least on my end) and it was working as expected. Godot's output terminal was not showing any error messages, either.
This commit is contained in:
parent
1e9d44fffc
commit
943e20a0de
|
@ -16,6 +16,7 @@ var saved := true # Checks if the user has saved
|
|||
# Canvas related stuff
|
||||
var canvases := [] setget canvases_changed
|
||||
var layers := [] setget layers_changed
|
||||
var layers_changed_skip := false
|
||||
var current_frame := 0 setget frame_changed
|
||||
var current_layer := 0 setget layer_changed
|
||||
# warning-ignore:unused_class_variable
|
||||
|
@ -500,6 +501,9 @@ func canvases_changed(value : Array) -> void:
|
|||
|
||||
func layers_changed(value : Array) -> void:
|
||||
layers = value
|
||||
if layers_changed_skip:
|
||||
layers_changed_skip = false
|
||||
return
|
||||
|
||||
for container in layers_container.get_children():
|
||||
container.queue_free()
|
||||
|
|
|
@ -55,6 +55,7 @@ func save_layer_name(new_name : String) -> void:
|
|||
line_edit.visible = false
|
||||
line_edit.editable = false
|
||||
label.text = new_name
|
||||
Global.layers_changed_skip = true
|
||||
Global.layers[i][0] = new_name
|
||||
|
||||
func _on_VisibilityButton_pressed() -> void:
|
||||
|
|
Loading…
Reference in a new issue