Skip to content

OS.move_to_trash() makes window lose and gain focus #99552

@gitsomebit

Description

@gitsomebit

Tested versions

Reproduced in 4.3 stable and 4.2 stable

System information

Godot v4.3.stable - Windows 10 - GLES3 (Compatibility)

Issue description

calling the OS.move_to_trash() function will cause the application window to lose and gain focus.

there are more issues with the window losing/gaining focus (see #99438), but I dont know if thats related.

Steps to reproduce

create a node and attache a script with the following code:

func _ready() -> void:
	get_window().focus_entered.connect(func_print.bind("enter"))
	get_window().focus_exited.connect(func_print.bind("exit"))
	
	await get_tree().create_timer(0.5).timeout
	OS.move_to_trash("res://not_exists.txt") # this will also cause an error 124 in the debug (note: error 124 is not defined in the return values btw), because input was not a global path, but it does not matter for the demonstration (window always loses & gains focus - no matter, if operation was successful or not)


func func_print(text):
	print(text)

the window will lose focus and gain it again shown in the output:

exit
enter

Minimal reproduction project (MRP)

trash-bug.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    For team assessment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions