Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming a file sometimes shows an error popup #90473

Closed
mieldepoche opened this issue Apr 10, 2024 · 11 comments · Fixed by #91112, #91361 or #92042
Closed

Renaming a file sometimes shows an error popup #90473

mieldepoche opened this issue Apr 10, 2024 · 11 comments · Fixed by #91112, #91361 or #92042

Comments

@mieldepoche
Copy link
Contributor

mieldepoche commented Apr 10, 2024

Tested versions

can happen in v4.3.dev.custom_build [a7b8602]

System information

linux

Issue description

simplescreenrecorder-2024-04-10_10.10.52.mp4
  • as you can see in this clip, renaming a file to an unused name still reports that the name is used in a popup. (the operation doesn't fail though)
  • it is not consistent (happened for a while on a test file and then, after writing the report, it stopped happening within the same editor instance)

Steps to reproduce

rename a file

Minimal reproduction project (MRP)

any

@jsjtxietian
Copy link
Contributor

jsjtxietian commented Apr 12, 2024

The _rename_operation_confirm is triggered twice, so the second time it already sees the file and gives the warning:

The call stack for first _rename_operation_confirm, popup_editor->hide() triggered this function call:

image

The second, item_edited triggered this function call:

image

cc @Wiwip Any ideas?

@aaronp64
Copy link
Contributor

This seems to impact renaming through both the tree view and split views, looks like FileSystemList and Tree both have similar issues with the popup/_line_editor_submit duplicate calls. I'm seeing the warning when pressing enter after renaming, but clicking out of the rename edit, or pressing escape, does not give the warning (but still changes the name, which I think is different from old behavior for pressing escape). Both _text_editor_popup_modal_close functions have checks for escape/enter keys being pressed to return early, which look like they were meant to prevent this, but don't seem to be stopping the _line_editor_submit call even if I purposely hold down the key after changing the name.

@aaronp64
Copy link
Contributor

Bisected to 9240034 on Windows. Looks like there used to be a timer that would delay the call to DisplayServerWindows::_process_activate_event when deactivating the window for the popup. This function calls Input::get_singleton()->release_pressed_events(), which clears out key_pressed info. With the key_pressed info being cleared out earlier now, _text_editor_popup_modal_close (for both Tree and FileSystemList) doesn't see the escape/enter keys pressed, so calls through to _rename_operation_confirm an additional time. Adding back the timer removes the warning, and restores the old behavior of pressing escape to not save the rename.

This only explains why it occurs on Windows though, issue was reported for Linux. Looks like display_server_x11.cpp also uses Input::get_singleton()->release_pressed_events(), but I can't test what changed around it to start behaving differently.

@akien-mga
Copy link
Member

akien-mga commented May 16, 2024

I can still reproduce this on Linux in latest master (4.3.beta 5708a3a).

When renaming a script file to a new name, this dialog appears:
image

The rename is still successful.

@akien-mga
Copy link
Member

akien-mga commented May 16, 2024

I can still reproduce this on Linux in latest master (4.3.beta 5708a3a).

So this report is a bit confusing, since:

We're going around in circles.

Maybe we didn't need #91112 in the end and should just revert that one? CC @RandomShaper @KoBeWi @bruvzg

@KoBeWi
Copy link
Member

KoBeWi commented May 16, 2024

#91112 fixes a few issues on Windows (including a crash), so it should be kept or superseded by a better fix.

@RandomShaper
Copy link
Member

Even if the bug was fixed by tweaking the code before #91112, that PR lays out a more robust way of handling such issues.

That said, I'm a bit puzzled about the issue having come back. Can you provide a stack trace at the point where the error dialog is triggered?

@akien-mga
Copy link
Member

Can you provide a stack trace at the point where the error dialog is triggered?

The error probably means that we're sending the confirmation twice or more, so the rename logic is run multiple times. It's successful the first time, and subsequent times fail because the file already has the new name.

I put a breakpoint on the warning:

Thread 1 "godot-git" hit Breakpoint 1, FileSystemDock::_rename_operation_confirm (this=0x14373770) at ./editor/filesystem_dock.cpp:1830
1830                    EditorNode::get_singleton()->show_warning(TTR("A file or folder with this name already exists."));
Missing separate debuginfos, use: dnf debuginfo-install alsa-lib-1.2.11-2.fc40.x86_64 bzip2-libs-1.0.8-18.fc40.x86_64 dbus-libs-1.14.10-3.fc40.x86_64 elfutils-libelf-0.191-4.fc40.x86_64 expat-2.6.2-1.fc40.x86_64 flac-libs-1.4.3-4.fc40.x86_64 fontconfig-2.15.0-4.fc40.x86_64 freetype-2.13.2-5.fc40.x86_64 glib2-2.80.2-1.fc40.x86_64 glibc-2.39-8.fc40.x86_64 graphite2-1.3.14-15.fc40.x86_64 gsm-1.0.22-6.fc40.x86_64 harfbuzz-8.4.0-1.fc40.x86_64 lame-libs-3.100-17.fc40.x86_64 libX11-1.8.9-1.fc40.x86_64 libX11-xcb-1.8.9-1.fc40.x86_64 libXcursor-1.2.1-7.fc40.x86_64 libXext-1.3.6-1.fc40.x86_64 libXfixes-6.0.1-3.fc40.x86_64 libXi-1.8.1-5.fc40.x86_64 libXinerama-1.1.5-6.fc40.x86_64 libXrender-0.9.11-6.fc40.x86_64 libbrotli-1.1.0-3.fc40.x86_64 libcap-2.69-8.fc40.x86_64 libdrm-2.4.120-3.fc40.x86_64 libedit-3.1-50.20230828cvs.fc40.x86_64 libffi-3.4.4-7.fc40.x86_64 libgcc-14.1.1-1.fc40.x86_64 libpng-1.6.40-3.fc40.x86_64 libsndfile-1.2.2-2.fc40.x86_64 libstdc++-14.1.1-1.fc40.x86_64 libvorbis-1.3.7-10.fc40.x86_64 libwayland-client-1.22.0-3.fc40.x86_64 libxcb-1.17.0-1.fc40.x86_64 libxkbcommon-1.6.0-2.fc40.x86_64 libxml2-2.12.6-1.fc40.x86_64 libzstd-1.5.6-1.fc40.x86_64 llvm-libs-18.1.1-1.fc40.x86_64 mesa-vulkan-drivers-24.0.7-1.fc40.x86_64 mpg123-libs-1.31.3-4.fc40.x86_64 ncurses-libs-6.4-12.20240127.fc40.x86_64 opus-1.5.1-1.fc40.x86_64 pcre2-10.42-2.fc40.2.x86_64 systemd-libs-255.6-1.fc40.x86_64 xz-libs-5.4.6-3.fc40.x86_64 zlib-ng-compat-2.1.6-2.fc40.x86_64
(gdb) bt
#0  FileSystemDock::_rename_operation_confirm (this=0x14373770) at ./editor/filesystem_dock.cpp:1830
#1  0x0000000007aa2397 in call_with_variant_args_helper<FileSystemDock>(FileSystemDock*, void (FileSystemDock::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (p_instance=0x14373770, 
    p_method=(void (FileSystemDock::*)(FileSystemDock * const)) 0x79947c2 <FileSystemDock::_rename_operation_confirm()>, p_args=0x0, r_error=...) at ./core/variant/binder_common.h:304
#2  0x0000000007a97b1a in call_with_variant_args<FileSystemDock> (p_instance=0x14373770, p_method=(void (FileSystemDock::*)(FileSystemDock * const)) 0x79947c2 <FileSystemDock::_rename_operation_confirm()>, 
    p_args=0x0, p_argcount=0, r_error=...) at ./core/variant/binder_common.h:418
#3  0x0000000007a64cf4 in CallableCustomMethodPointer<FileSystemDock>::call (this=0x1440bed0, p_arguments=0x0, p_argcount=0, r_return_value=..., r_call_error=...) at ./core/object/callable_method_pointer.h:103
#4  0x000000000a7daf73 in Callable::callp (this=0x7fffffff8cf0, p_arguments=0x0, p_argcount=0, r_return_value=..., r_call_error=...) at ./core/variant/callable.cpp:57
#5  0x000000000ab1451d in Object::emit_signalp (this=0x143d9060, p_name=..., p_args=0x0, p_argcount=0) at ./core/object/object.cpp:1219
#6  0x000000000864d092 in Node::emit_signalp (this=0x143d9060, p_name=..., p_args=0x0, p_argcount=0) at ./scene/main/node.cpp:3884
#7  0x000000000621fd03 in Object::emit_signal<>(StringName const&) (this=0x143d9060, p_name=...) at ./core/object/object.h:936
#8  0x00000000089963e0 in Tree::item_edited (this=0x143d9060, p_column=0, p_item=0x1eaee690, p_custom_mouse_index=MouseButton::NONE) at ./scene/gui/tree.cpp:4466
#9  0x000000000898e609 in Tree::_line_editor_submit (this=0x143d9060, p_text=...) at ./scene/gui/tree.cpp:3241
#10 0x0000000008be235d in call_with_variant_args_helper<Tree, String, 0ul> (p_instance=0x143d9060, p_method=(void (Tree::*)(Tree * const, String)) 0x898e414 <Tree::_line_editor_submit(String)>, 
    p_args=0x7fffffff94c0, r_error=...) at ./core/variant/binder_common.h:304
#11 0x0000000008bb3773 in call_with_variant_args<Tree, String> (p_instance=0x143d9060, p_method=(void (Tree::*)(Tree * const, String)) 0x898e414 <Tree::_line_editor_submit(String)>, p_args=0x7fffffff94c0, 
    p_argcount=1, r_error=...) at ./core/variant/binder_common.h:418
#12 0x0000000008b6a84a in CallableCustomMethodPointer<Tree, String>::call (this=0x144060c0, p_arguments=0x7fffffff94c0, p_argcount=1, r_return_value=..., r_call_error=...)
    at ./core/object/callable_method_pointer.h:103
#13 0x000000000a7daf73 in Callable::callp (this=0x7fffffff92a0, p_arguments=0x7fffffff94c0, p_argcount=1, r_return_value=..., r_call_error=...) at ./core/variant/callable.cpp:57
#14 0x000000000ab1451d in Object::emit_signalp (this=0x143f1530, p_name=..., p_args=0x7fffffff94c0, p_argcount=1) at ./core/object/object.cpp:1219
#15 0x000000000864d092 in Node::emit_signalp (this=0x143f1530, p_name=..., p_args=0x7fffffff94c0, p_argcount=1) at ./scene/main/node.cpp:3884
#16 0x0000000006cf01c4 in Object::emit_signal<String> (this=0x143f1530, p_name=...) at ./core/object/object.h:936
#17 0x0000000008878e59 in LineEdit::gui_input (this=0x143f1530, p_event=...) at ./scene/gui/line_edit.cpp:502
#18 0x00000000087fb279 in Control::_call_gui_input (this=0x143f1530, p_event=...) at ./scene/gui/control.cpp:1825
--Type <RET> for more, q to quit, c to continue without paging--
#19 0x000000000866cef9 in Viewport::_gui_input_event (this=0x143ea350, p_event=...) at ./scene/main/viewport.cpp:2197
#20 0x0000000008672182 in Viewport::push_input (this=0x143ea350, p_event=..., p_local_coords=false) at ./scene/main/viewport.cpp:3248
#21 0x000000000869715d in Window::_window_input (this=0x143ea350, p_ev=...) at ./scene/main/window.cpp:1628
#22 0x000000000879cf5b in call_with_variant_args_helper<Window, Ref<InputEvent> const&, 0ul> (p_instance=0x143ea350, 
    p_method=(void (Window::*)(Window * const, const Ref<InputEvent> &)) 0x8696c02 <Window::_window_input(Ref<InputEvent> const&)>, p_args=0x7fffffffc6c0, r_error=...) at ./core/variant/binder_common.h:304
#23 0x000000000877f616 in call_with_variant_args<Window, Ref<InputEvent> const&> (p_instance=0x143ea350, 
    p_method=(void (Window::*)(Window * const, const Ref<InputEvent> &)) 0x8696c02 <Window::_window_input(Ref<InputEvent> const&)>, p_args=0x7fffffffc6c0, p_argcount=1, r_error=...)
    at ./core/variant/binder_common.h:418
#24 0x000000000875e590 in CallableCustomMethodPointer<Window, Ref<InputEvent> const&>::call (this=0x143ec480, p_arguments=0x7fffffffc6c0, p_argcount=1, r_return_value=..., r_call_error=...)
    at ./core/object/callable_method_pointer.h:103
#25 0x000000000a7daf73 in Callable::callp (this=0x7fffffffc770, p_arguments=0x7fffffffc6c0, p_argcount=1, r_return_value=..., r_call_error=...) at ./core/variant/callable.cpp:57
#26 0x0000000005b1bd75 in Callable::call<Ref<InputEvent> > (this=0x7fffffffc770) at ./core/variant/variant.h:875
#27 0x0000000005b080e0 in DisplayServerX11::_dispatch_input_event (this=0xbb26da0, p_event=...) at platform/linuxbsd/x11/display_server_x11.cpp:4012
#28 0x0000000005b07fc5 in DisplayServerX11::_dispatch_input_events (p_event=...) at platform/linuxbsd/x11/display_server_x11.cpp:4001
#29 0x000000000a77844f in Input::_parse_input_event_impl (this=0xb346ec0, p_event=..., p_is_emulated=false) at ./core/input/input.cpp:773
#30 0x000000000a77974a in Input::flush_buffered_events (this=0xb346ec0) at ./core/input/input.cpp:1044
#31 0x0000000005b0ce95 in DisplayServerX11::process_events (this=0xbb26da0) at platform/linuxbsd/x11/display_server_x11.cpp:5123
#32 0x0000000005ae500c in OS_LinuxBSD::run (this=0x7fffffffd0e0) at platform/linuxbsd/os_linuxbsd.cpp:958
#33 0x0000000005adddb1 in main (argc=2, argv=0x7fffffffd738) at platform/linuxbsd/godot_linuxbsd.cpp:85
(gdb) print new_path
$1 = {_cowdata = {static MAX_INT = <optimized out>, static REF_COUNT_OFFSET = <optimized out>, static SIZE_OFFSET = <optimized out>, static DATA_OFFSET = <optimized out>, _ptr = 0x1ee6a440 U"res://test.gd"}, 
  static _null = 0 U'\000', static _replacement_char = 65533 U'�'}
(gdb) print old_path
$2 = {_cowdata = {static MAX_INT = <optimized out>, static REF_COUNT_OFFSET = <optimized out>, static SIZE_OFFSET = <optimized out>, static DATA_OFFSET = <optimized out>, _ptr = 0x24436d00 U"res://ddda.gd"}, 
  static _null = 0 U'\000', static _replacement_char = 65533 U'�'}

@akien-mga
Copy link
Member

Putting the breakpoint a bit further up, I can confirm that FileSystemDock::_rename_operation_confirm is called twice. It's successful the first time, and the second time triggers the error since the name already changed.

Thread 1 "godot-git" hit Breakpoint 2, FileSystemDock::_rename_operation_confirm (this=0x14aadd80) at ./editor/filesystem_dock.cpp:1825
1825            bool new_exist = (da->file_exists(new_path) || da->dir_exists(new_path));
(gdb) bt
#0  FileSystemDock::_rename_operation_confirm (this=0x14aadd80) at ./editor/filesystem_dock.cpp:1825
#1  0x0000000007aa2397 in call_with_variant_args_helper<FileSystemDock>(FileSystemDock*, void (FileSystemDock::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (p_instance=0x14aadd80, 
    p_method=(void (FileSystemDock::*)(FileSystemDock * const)) 0x79947c2 <FileSystemDock::_rename_operation_confirm()>, p_args=0x0, r_error=...) at ./core/variant/binder_common.h:304
#2  0x0000000007a97b1a in call_with_variant_args<FileSystemDock> (p_instance=0x14aadd80, p_method=(void (FileSystemDock::*)(FileSystemDock * const)) 0x79947c2 <FileSystemDock::_rename_operation_confirm()>, 
    p_args=0x0, p_argcount=0, r_error=...) at ./core/variant/binder_common.h:418
#3  0x0000000007a64cf4 in CallableCustomMethodPointer<FileSystemDock>::call (this=0x14b464e0, p_arguments=0x0, p_argcount=0, r_return_value=..., r_call_error=...) at ./core/object/callable_method_pointer.h:103
#4  0x000000000a7daf73 in Callable::callp (this=0x7fffffff8600, p_arguments=0x0, p_argcount=0, r_return_value=..., r_call_error=...) at ./core/variant/callable.cpp:57
#5  0x000000000ab1451d in Object::emit_signalp (this=0x14b13670, p_name=..., p_args=0x0, p_argcount=0) at ./core/object/object.cpp:1219
#6  0x000000000864d092 in Node::emit_signalp (this=0x14b13670, p_name=..., p_args=0x0, p_argcount=0) at ./scene/main/node.cpp:3884
#7  0x000000000621fd03 in Object::emit_signal<>(StringName const&) (this=0x14b13670, p_name=...) at ./core/object/object.h:936
#8  0x00000000089963e0 in Tree::item_edited (this=0x14b13670, p_column=0, p_item=0x22e7c420, p_custom_mouse_index=MouseButton::NONE) at ./scene/gui/tree.cpp:4466
#9  0x000000000898e609 in Tree::_line_editor_submit (this=0x14b13670, p_text=...) at ./scene/gui/tree.cpp:3241
#10 0x000000000898e1c2 in Tree::_text_editor_popup_modal_close (this=0x14b13670) at ./scene/gui/tree.cpp:3170
#11 0x00000000078b66cb in call_with_variant_args_helper<Tree>(Tree*, void (Tree::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (p_instance=0x14b13670, 
    p_method=(void (Tree::*)(Tree * const)) 0x898e098 <Tree::_text_editor_popup_modal_close()>, p_args=0x0, r_error=...) at ./core/variant/binder_common.h:304
#12 0x00000000078a586f in call_with_variant_args<Tree> (p_instance=0x14b13670, p_method=(void (Tree::*)(Tree * const)) 0x898e098 <Tree::_text_editor_popup_modal_close()>, p_args=0x0, p_argcount=0, r_error=...)
    at ./core/variant/binder_common.h:418
#13 0x0000000007882954 in CallableCustomMethodPointer<Tree>::call (this=0x14b40d90, p_arguments=0x0, p_argcount=0, r_return_value=..., r_call_error=...) at ./core/object/callable_method_pointer.h:103
#14 0x000000000a7daf73 in Callable::callp (this=0x7fffffff8bd0, p_arguments=0x0, p_argcount=0, r_return_value=..., r_call_error=...) at ./core/variant/callable.cpp:57
#15 0x000000000ab1451d in Object::emit_signalp (this=0x14b24960, p_name=..., p_args=0x0, p_argcount=0) at ./core/object/object.cpp:1219
#16 0x000000000864d092 in Node::emit_signalp (this=0x14b24960, p_name=..., p_args=0x0, p_argcount=0) at ./scene/main/node.cpp:3884
#17 0x000000000621fd03 in Object::emit_signal<>(StringName const&) (this=0x14b24960, p_name=...) at ./core/object/object.h:936
#18 0x00000000088a5dec in Popup::_notification (this=0x14b24960, p_what=30) at ./scene/gui/popup.cpp:83
#19 0x000000000775eb1a in Popup::_notificationv (this=0x14b24960, p_notification=30, p_reversed=false) at ./scene/gui/popup.h:41
--Type <RET> for more, q to quit, c to continue without paging--
#20 0x000000000ab127c2 in Object::notification (this=0x14b24960, p_notification=30, p_reversed=false) at ./core/object/object.cpp:903
#21 0x0000000008692b82 in Window::set_visible (this=0x14b24960, p_visible=false) at ./scene/main/window.cpp:847
#22 0x00000000086927da in Window::hide (this=0x14b24960) at ./scene/main/window.cpp:798
#23 0x000000000898e438 in Tree::_line_editor_submit (this=0x14b13670, p_text=...) at ./scene/gui/tree.cpp:3208
#24 0x0000000008be235d in call_with_variant_args_helper<Tree, String, 0ul> (p_instance=0x14b13670, p_method=(void (Tree::*)(Tree * const, String)) 0x898e414 <Tree::_line_editor_submit(String)>, 
    p_args=0x7fffffff94c0, r_error=...) at ./core/variant/binder_common.h:304
#25 0x0000000008bb3773 in call_with_variant_args<Tree, String> (p_instance=0x14b13670, p_method=(void (Tree::*)(Tree * const, String)) 0x898e414 <Tree::_line_editor_submit(String)>, p_args=0x7fffffff94c0, 
    p_argcount=1, r_error=...) at ./core/variant/binder_common.h:418
#26 0x0000000008b6a84a in CallableCustomMethodPointer<Tree, String>::call (this=0x14b406d0, p_arguments=0x7fffffff94c0, p_argcount=1, r_return_value=..., r_call_error=...)
    at ./core/object/callable_method_pointer.h:103
#27 0x000000000a7daf73 in Callable::callp (this=0x7fffffff92a0, p_arguments=0x7fffffff94c0, p_argcount=1, r_return_value=..., r_call_error=...) at ./core/variant/callable.cpp:57
#28 0x000000000ab1451d in Object::emit_signalp (this=0x14b2bb40, p_name=..., p_args=0x7fffffff94c0, p_argcount=1) at ./core/object/object.cpp:1219
#29 0x000000000864d092 in Node::emit_signalp (this=0x14b2bb40, p_name=..., p_args=0x7fffffff94c0, p_argcount=1) at ./scene/main/node.cpp:3884
#30 0x0000000006cf01c4 in Object::emit_signal<String> (this=0x14b2bb40, p_name=...) at ./core/object/object.h:936
#31 0x0000000008878e59 in LineEdit::gui_input (this=0x14b2bb40, p_event=...) at ./scene/gui/line_edit.cpp:502
#32 0x00000000087fb279 in Control::_call_gui_input (this=0x14b2bb40, p_event=...) at ./scene/gui/control.cpp:1825
#33 0x000000000866cef9 in Viewport::_gui_input_event (this=0x14b24960, p_event=...) at ./scene/main/viewport.cpp:2197
#34 0x0000000008672182 in Viewport::push_input (this=0x14b24960, p_event=..., p_local_coords=false) at ./scene/main/viewport.cpp:3248
#35 0x000000000869715d in Window::_window_input (this=0x14b24960, p_ev=...) at ./scene/main/window.cpp:1628
#36 0x000000000879cf5b in call_with_variant_args_helper<Window, Ref<InputEvent> const&, 0ul> (p_instance=0x14b24960, 
    p_method=(void (Window::*)(Window * const, const Ref<InputEvent> &)) 0x8696c02 <Window::_window_input(Ref<InputEvent> const&)>, p_args=0x7fffffffc6c0, r_error=...) at ./core/variant/binder_common.h:304
#37 0x000000000877f616 in call_with_variant_args<Window, Ref<InputEvent> const&> (p_instance=0x14b24960, 
    p_method=(void (Window::*)(Window * const, const Ref<InputEvent> &)) 0x8696c02 <Window::_window_input(Ref<InputEvent> const&)>, p_args=0x7fffffffc6c0, p_argcount=1, r_error=...)
    at ./core/variant/binder_common.h:418
--Type <RET> for more, q to quit, c to continue without paging--
#38 0x000000000875e590 in CallableCustomMethodPointer<Window, Ref<InputEvent> const&>::call (this=0x14b26a90, p_arguments=0x7fffffffc6c0, p_argcount=1, r_return_value=..., r_call_error=...)
    at ./core/object/callable_method_pointer.h:103
#39 0x000000000a7daf73 in Callable::callp (this=0x7fffffffc770, p_arguments=0x7fffffffc6c0, p_argcount=1, r_return_value=..., r_call_error=...) at ./core/variant/callable.cpp:57
#40 0x0000000005b1bd75 in Callable::call<Ref<InputEvent> > (this=0x7fffffffc770) at ./core/variant/variant.h:875
#41 0x0000000005b080e0 in DisplayServerX11::_dispatch_input_event (this=0xbb26700, p_event=...) at platform/linuxbsd/x11/display_server_x11.cpp:4012
#42 0x0000000005b07fc5 in DisplayServerX11::_dispatch_input_events (p_event=...) at platform/linuxbsd/x11/display_server_x11.cpp:4001
#43 0x000000000a77844f in Input::_parse_input_event_impl (this=0xb346ec0, p_event=..., p_is_emulated=false) at ./core/input/input.cpp:773
#44 0x000000000a77974a in Input::flush_buffered_events (this=0xb346ec0) at ./core/input/input.cpp:1044
#45 0x0000000005b0ce95 in DisplayServerX11::process_events (this=0xbb26700) at platform/linuxbsd/x11/display_server_x11.cpp:5123
#46 0x0000000005ae500c in OS_LinuxBSD::run (this=0x7fffffffd0e0) at platform/linuxbsd/os_linuxbsd.cpp:958
#47 0x0000000005adddb1 in main (argc=2, argv=0x7fffffffd738) at platform/linuxbsd/godot_linuxbsd.cpp:85
(gdb) c
Continuing.
[New Thread 0x7fff9f4006c0 (LWP 73091)]

Thread 1 "godot-git" hit Breakpoint 2, FileSystemDock::_rename_operation_confirm (this=0x14aadd80) at ./editor/filesystem_dock.cpp:1825
1825            bool new_exist = (da->file_exists(new_path) || da->dir_exists(new_path));
(gdb) bt
#0  FileSystemDock::_rename_operation_confirm (this=0x14aadd80) at ./editor/filesystem_dock.cpp:1825
#1  0x0000000007aa2397 in call_with_variant_args_helper<FileSystemDock>(FileSystemDock*, void (FileSystemDock::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (p_instance=0x14aadd80, 
    p_method=(void (FileSystemDock::*)(FileSystemDock * const)) 0x79947c2 <FileSystemDock::_rename_operation_confirm()>, p_args=0x0, r_error=...) at ./core/variant/binder_common.h:304
#2  0x0000000007a97b1a in call_with_variant_args<FileSystemDock> (p_instance=0x14aadd80, p_method=(void (FileSystemDock::*)(FileSystemDock * const)) 0x79947c2 <FileSystemDock::_rename_operation_confirm()>, 
    p_args=0x0, p_argcount=0, r_error=...) at ./core/variant/binder_common.h:418
#3  0x0000000007a64cf4 in CallableCustomMethodPointer<FileSystemDock>::call (this=0x14b464e0, p_arguments=0x0, p_argcount=0, r_return_value=..., r_call_error=...) at ./core/object/callable_method_pointer.h:103
#4  0x000000000a7daf73 in Callable::callp (this=0x7fffffff8cf0, p_arguments=0x0, p_argcount=0, r_return_value=..., r_call_error=...) at ./core/variant/callable.cpp:57
#5  0x000000000ab1451d in Object::emit_signalp (this=0x14b13670, p_name=..., p_args=0x0, p_argcount=0) at ./core/object/object.cpp:1219
#6  0x000000000864d092 in Node::emit_signalp (this=0x14b13670, p_name=..., p_args=0x0, p_argcount=0) at ./scene/main/node.cpp:3884
#7  0x000000000621fd03 in Object::emit_signal<>(StringName const&) (this=0x14b13670, p_name=...) at ./core/object/object.h:936
#8  0x00000000089963e0 in Tree::item_edited (this=0x14b13670, p_column=0, p_item=0x22e7c420, p_custom_mouse_index=MouseButton::NONE) at ./scene/gui/tree.cpp:4466
#9  0x000000000898e609 in Tree::_line_editor_submit (this=0x14b13670, p_text=...) at ./scene/gui/tree.cpp:3241
#10 0x0000000008be235d in call_with_variant_args_helper<Tree, String, 0ul> (p_instance=0x14b13670, p_method=(void (Tree::*)(Tree * const, String)) 0x898e414 <Tree::_line_editor_submit(String)>, 
    p_args=0x7fffffff94c0, r_error=...) at ./core/variant/binder_common.h:304
#11 0x0000000008bb3773 in call_with_variant_args<Tree, String> (p_instance=0x14b13670, p_method=(void (Tree::*)(Tree * const, String)) 0x898e414 <Tree::_line_editor_submit(String)>, p_args=0x7fffffff94c0, 
    p_argcount=1, r_error=...) at ./core/variant/binder_common.h:418
#12 0x0000000008b6a84a in CallableCustomMethodPointer<Tree, String>::call (this=0x14b406d0, p_arguments=0x7fffffff94c0, p_argcount=1, r_return_value=..., r_call_error=...)
    at ./core/object/callable_method_pointer.h:103
#13 0x000000000a7daf73 in Callable::callp (this=0x7fffffff92a0, p_arguments=0x7fffffff94c0, p_argcount=1, r_return_value=..., r_call_error=...) at ./core/variant/callable.cpp:57
#14 0x000000000ab1451d in Object::emit_signalp (this=0x14b2bb40, p_name=..., p_args=0x7fffffff94c0, p_argcount=1) at ./core/object/object.cpp:1219
#15 0x000000000864d092 in Node::emit_signalp (this=0x14b2bb40, p_name=..., p_args=0x7fffffff94c0, p_argcount=1) at ./scene/main/node.cpp:3884
#16 0x0000000006cf01c4 in Object::emit_signal<String> (this=0x14b2bb40, p_name=...) at ./core/object/object.h:936
#17 0x0000000008878e59 in LineEdit::gui_input (this=0x14b2bb40, p_event=...) at ./scene/gui/line_edit.cpp:502
#18 0x00000000087fb279 in Control::_call_gui_input (this=0x14b2bb40, p_event=...) at ./scene/gui/control.cpp:1825
--Type <RET> for more, q to quit, c to continue without paging--
#19 0x000000000866cef9 in Viewport::_gui_input_event (this=0x14b24960, p_event=...) at ./scene/main/viewport.cpp:2197
#20 0x0000000008672182 in Viewport::push_input (this=0x14b24960, p_event=..., p_local_coords=false) at ./scene/main/viewport.cpp:3248
#21 0x000000000869715d in Window::_window_input (this=0x14b24960, p_ev=...) at ./scene/main/window.cpp:1628
#22 0x000000000879cf5b in call_with_variant_args_helper<Window, Ref<InputEvent> const&, 0ul> (p_instance=0x14b24960, 
    p_method=(void (Window::*)(Window * const, const Ref<InputEvent> &)) 0x8696c02 <Window::_window_input(Ref<InputEvent> const&)>, p_args=0x7fffffffc6c0, r_error=...) at ./core/variant/binder_common.h:304
#23 0x000000000877f616 in call_with_variant_args<Window, Ref<InputEvent> const&> (p_instance=0x14b24960, 
    p_method=(void (Window::*)(Window * const, const Ref<InputEvent> &)) 0x8696c02 <Window::_window_input(Ref<InputEvent> const&)>, p_args=0x7fffffffc6c0, p_argcount=1, r_error=...)
    at ./core/variant/binder_common.h:418
#24 0x000000000875e590 in CallableCustomMethodPointer<Window, Ref<InputEvent> const&>::call (this=0x14b26a90, p_arguments=0x7fffffffc6c0, p_argcount=1, r_return_value=..., r_call_error=...)
    at ./core/object/callable_method_pointer.h:103
#25 0x000000000a7daf73 in Callable::callp (this=0x7fffffffc770, p_arguments=0x7fffffffc6c0, p_argcount=1, r_return_value=..., r_call_error=...) at ./core/variant/callable.cpp:57
#26 0x0000000005b1bd75 in Callable::call<Ref<InputEvent> > (this=0x7fffffffc770) at ./core/variant/variant.h:875
#27 0x0000000005b080e0 in DisplayServerX11::_dispatch_input_event (this=0xbb26700, p_event=...) at platform/linuxbsd/x11/display_server_x11.cpp:4012
#28 0x0000000005b07fc5 in DisplayServerX11::_dispatch_input_events (p_event=...) at platform/linuxbsd/x11/display_server_x11.cpp:4001
#29 0x000000000a77844f in Input::_parse_input_event_impl (this=0xb346ec0, p_event=..., p_is_emulated=false) at ./core/input/input.cpp:773
#30 0x000000000a77974a in Input::flush_buffered_events (this=0xb346ec0) at ./core/input/input.cpp:1044
#31 0x0000000005b0ce95 in DisplayServerX11::process_events (this=0xbb26700) at platform/linuxbsd/x11/display_server_x11.cpp:5123
#32 0x0000000005ae500c in OS_LinuxBSD::run (this=0x7fffffffd0e0) at platform/linuxbsd/os_linuxbsd.cpp:958
#33 0x0000000005adddb1 in main (argc=2, argv=0x7fffffffd738) at platform/linuxbsd/godot_linuxbsd.cpp:85
(gdb) 
(gdb) c
Continuing.

Thread 1 "godot-git" hit Breakpoint 1, FileSystemDock::_rename_operation_confirm (this=0x14aadd80) at ./editor/filesystem_dock.cpp:1830
1830                    EditorNode::get_singleton()->show_warning(TTR("A file or folder with this name already exists."));

@bruvzg
Copy link
Member

bruvzg commented May 16, 2024

Putting the breakpoint a bit further up, I can confirm that FileSystemDock::_rename_operation_confirm is called twice. It's successful the first time, and the second time triggers the error since the name already changed.

I guess it's the opposite order of double event from what #91112 fixed, closeinput instead of inputclose. I'll take a look tomorrow, it probably needs a more universal checks that aren't dependent on event order.

@bruvzg
Copy link
Member

bruvzg commented May 17, 2024

Also seems to be reproducible on macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment