Skip to content

Commit 9825f7f

Browse files
committed
Fixed cases where CTRL+Tab or Modal can occasionally lead to the creation of ImDrawCmd with zero triangles. (#4857, #5937)
Amend b0a6cd6
1 parent 66ad2ad commit 9825f7f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

docs/CHANGELOG.txt

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ Breaking changes:
3939

4040
Other changes:
4141

42+
- Fixed cases where CTRL+Tab or Modal can occasionally lead to the creation of ImDrawCmd with
43+
zero triangles, which would makes the render loop of some backends assert (e.g. Metal with
44+
debugging, Allegro). (#4857, #5937)
4245
- Inputs, Scrolling: better selection of scrolling window when hovering nested windows
4346
and when backend/OS is emitting dual-axis wheeling inputs (typically touch pads on macOS).
4447
We now select a primary axis based on recent events, and select a target window based on it.

imgui_draw.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,7 @@ void ImDrawList::_PopUnusedDrawCmd()
449449
{
450450
if (CmdBuffer.Size == 0)
451451
return;
452-
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
453-
if (curr_cmd->ElemCount == 0 && curr_cmd->UserCallback == NULL)
452+
for (ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; curr_cmd->ElemCount == 0 && curr_cmd->UserCallback == NULL; curr_cmd--)
454453
CmdBuffer.pop_back();
455454
}
456455

0 commit comments

Comments
 (0)