-
-
Notifications
You must be signed in to change notification settings - Fork 23.5k
Fix TabBar Hidden Tabs Handling #106257
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
Fix TabBar Hidden Tabs Handling #106257
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tab_separation changes also need to be done in the draw selected tab (below the draw unselected tab) and in TabBar::get_tab_rect.
It looks like the segfault only happened in a previous commit of #106164, so it is hard to debug. There is probably a deeper issue there that caused it. The current changes to TabContainer look fine.
000302c to
87acf3d
Compare
|
Ok, I took a deeper look at how the Known: Issue with clipping tabs that clips them at the wrong positions, looking into it. (Fixed) |
1ad2dca to
5003d95
Compare
|
Alright, here's what I did: I reworked how it calculates where to place the dropping texture (the bar that shows up between tabs). Instead of calculating the average distance between tabs one apart, it merely adds and subtracts half the I took the opportunity to add the I also reworked the |
5003d95 to
41a39de
Compare
41a39de to
33078a3
Compare
33078a3 to
8e5389b
Compare
8e5389b to
1359e06
Compare
kitbdev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
I think we should update the PR and commit title to be more accurate, since it does more than change the drawing logic. The segfault is more of a potential segfault too since it doesn't really happen in master. Something like "Fix TabBar hidden tabs handling".
1359e06 to
5fbc8a6
Compare
|
Thanks! |
See: #106164
These bugfixes are related but necessary for the above PR to function.
The first fix is in TabContainer. Currently TabContainer calls
_update_marginsin theadd_child_notifymethod. Since it adds theTabBaras a child upon being allocated and the theme cache is not set when allocating theEditorBottomPanelclass, this leads to a segfault as it is trying to access a nullptr. This PR fixes the bug by wrapping the theme access behind an if statement, removing many redundant ternaries.The second fix is in TabBar's theme constants. The
tab_separationtheme variable did not work correctly where hidden tabs intermixed with non-hidden tabs could still add their separation even though they are not visible. This PR solves the issue by only adding the separation for non-hidden tabs.