Closed kalysti closed 2 years ago
Working on a pr..
Could you please provide a example project where the crash occurs?
Okay, it's one of my mistakes. Childs of the Tabs Component are not automatically added to tabs. Why do I have to call the add_tab method for this? I mean they are childs, make no sense to add them manualy. Now I have also understood the stack trace.
So i blv the best solution is adding childs automatically to the Tabs component.
Could you please provide a example project where the crash occurs?
Just create a Tabs Component, and add a TabContainer as Child -> Stack Trace. Its because gui input is not fowarded, because the Tabs Component are not adding childs automaticly.
Okay, it's one of my mistakes. Childs of the Tabs Component are not automatically added to tabs. Why do I have to call the add_tab method for this? I mean they are childs, make no sense to add them manualy. Now I have also understood the stack trace. So i blv the best solution is adding childs automatically to the Tabs component.
I will repeat the answer I gave you in that PR:
If you want a node that adds tabs automatically when children are added, use TabContainer
. Tabs
is a more fine grained node that gives you a lot of options, but you have to do stuff yourself.
Never mind -> a stack trace is a stack trace. We need a solution for this.
Childs needs to be add automaticly to the Tabs Component. Otherwise u cant solve the stack trace.
You are not supposed to add any children to the Tabs
control. Tabs
control is just a tab bar. That's it. It can be used for any behavior you need from switching the tabs. TabContainer
on the other hand is what you use to add child controls as tabs automatically. These two are not to be used together, and they are not a replacement for each other.
Well the class description even tells you so
Simple tabs control, similar to TabContainer but is only in charge of drawing tabs, not interacting with children.
EDIT: As for the crash, it happens if the Tabs don't have any tab. Children don't affect anything.
It happens on this line: https://github.com/godotengine/godot/blob/468b987aa38b21b55c1cd8a8d4c03b8e1b2a1373/scene/gui/tabs.cpp#L227
gui_input()
should probably check whether tabs are empty and just return
if yes. Or if input in empty Tabs makes sense, it should check before accessing tabs.
Well the class description even tells you so
Simple tabs control, similar to TabContainer but is only in charge of drawing tabs, not interacting with children.
EDIT: As for the crash, it happens if the Tabs don't have any tab. Children don't affect anything.
It happens on this line:
gui_input()
should probably check whether tabs are empty and justreturn
if yes. Or if input in empty Tabs makes sense, it should check before accessing tabs.
Thanks for it, and also for renaming Tabs to TabBar, i blv now everybody will understand it directly 👍
So has this been fixed now? Is anyone still working on this?
It still needs a fix and there isn't any PR open right now.
Godot version
4.0
System information
Windows 11
Issue description
Broken tabs.
Steps to reproduce
Minimal reproduction project
No response