mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-21 07:16:34 +00:00
Docking: Fixed bad ever-growing/ leak (accumulating text into TabsNames forever, fix d38f4dc14
from February 5th, affected docking branch only). (#2109)
This commit is contained in:
parent
5412cdf2c8
commit
7573d10a4a
@ -6452,8 +6452,17 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
|||||||
tab->Window = docked_window;
|
tab->Window = docked_window;
|
||||||
|
|
||||||
// Append name with zero-terminator
|
// Append name with zero-terminator
|
||||||
tab->NameOffset = tab_bar->TabsNames.size();
|
if (tab_bar->Flags & ImGuiTabBarFlags_DockNode)
|
||||||
tab_bar->TabsNames.append(label, label + strlen(label) + 1);
|
{
|
||||||
|
IM_ASSERT(tab->Window != NULL);
|
||||||
|
tab->NameOffset = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IM_ASSERT(tab->Window == NULL);
|
||||||
|
tab->NameOffset = tab_bar->TabsNames.size();
|
||||||
|
tab_bar->TabsNames.append(label, label + strlen(label) + 1); // Append name _with_ the zero-terminator.
|
||||||
|
}
|
||||||
|
|
||||||
// If we are not reorderable, always reset offset based on submission order.
|
// If we are not reorderable, always reset offset based on submission order.
|
||||||
// (We already handled layout and sizing using the previous known order, but sizing is not affected by order!)
|
// (We already handled layout and sizing using the previous known order, but sizing is not affected by order!)
|
||||||
|
Loading…
Reference in New Issue
Block a user