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

Crash when attempt to Close Other Scripts From Right Click Drop Down #63061

Closed
Chevifier opened this issue Jul 16, 2022 · 5 comments · Fixed by #63145
Closed

Crash when attempt to Close Other Scripts From Right Click Drop Down #63061

Chevifier opened this issue Jul 16, 2022 · 5 comments · Fixed by #63145

Comments

@Chevifier
Copy link

Chevifier commented Jul 16, 2022

Godot version

4.0 dev Alpha 12

System information

Linux, Ubuntu 22.04 LTS

Issue description

https://youtu.be/0ioEK-o6NcA

Crash occurs when I attempt to close other tabs.
Note intermittently happens with only a few(3) open.

Steps to reproduce

  1. Open Godot 4 Alpha 12
  2. Open plenty of Scripts
  3. Right Click any Script in the Scripts list
  4. Select Close Other Tabs

Minimal reproduction project

No response

@Dssdiego
Copy link

It doesn't seem to happen on a Windows Machine

Godot version
4.0 dev Alpha 12

System information
Windows 10 Pro (10.0.19044 Build 19044)

bug_replication_windows.mov

@Rindbee
Copy link
Contributor

Rindbee commented Jul 17, 2022

Easier to get error messages when closing unsaved scripts or removing the open script file from FileSystem dock. May be related to #62964. it seems to have been around for a long time.

ERROR: Condition "!is_inside_tree()" is true.
   at: grab_focus (scene/gui/control.cpp:2532)

1

@Zylann
Copy link
Contributor

Zylann commented Jul 17, 2022

I also get this error when I close a script with Ctrl+W:

RROR: Condition "!is_inside_tree()" is true.
   at: Control::grab_focus (scene\gui\control.cpp:2532)

But not always 🤷 (at least not when opening a new script and immediately closing it)

Call stack:
image

@Rindbee
Copy link
Contributor

Rindbee commented Jul 18, 2022

Removing the current tab control of the TabContainer will first remove the corresponding tab from the internal TabBar, and if the removed tab is the current one, the tab_changed signal will be emitted. This causes the tab_changed signal to emitted before the tab control is actually removed.

After the tab_changed signal is emitted, the control obtained using get_current_tab may be the control being deleted. The tab in the TabBar has changed, but the tab control in the TabContainer has not changed yet.

tab_bar->connect("tab_changed", callable_mp(this, &TabContainer::_on_tab_changed));

tab_bar->remove_tab(get_tab_idx_from_control(c));

godot/scene/gui/tab_bar.cpp

Lines 959 to 961 in dfc76dc

tabs.remove_at(p_idx);
bool is_tab_changing = current == p_idx && !tabs.is_empty();

godot/scene/gui/tab_bar.cpp

Lines 986 to 988 in dfc76dc

if (is_tab_changing && is_inside_tree()) {
emit_signal(SNAME("tab_changed"), current);
}

void TabContainer::_on_tab_changed(int p_tab) {
call_deferred(SNAME("_repaint"));
emit_signal(SNAME("tab_changed"), p_tab);

@Paulb23
Copy link
Member

Paulb23 commented Jul 18, 2022

That backtrack looks familiar, duplicate of #61689

@Paulb23 Paulb23 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants