Skip to content

Commit

Permalink
Added workaround for bug that appears to put sentinels at unexpected …
Browse files Browse the repository at this point in the history
…locations in the draw list, causing crashes
  • Loading branch information
azonenberg committed Nov 29, 2023
1 parent da5bd51 commit 6b7fe16
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions imgui_canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,20 @@ void ImGuiEx::Canvas::LeaveLocalSpace()
m_DrawList->CmdBuffer.erase(m_DrawList->CmdBuffer.Data + m_DrawListCommadBufferSize);
else if (m_DrawList->CmdBuffer.size() >= m_DrawListCommadBufferSize && m_DrawList->CmdBuffer[m_DrawListCommadBufferSize - 1].UserCallback == ImDrawCallback_ImCanvas)
m_DrawList->CmdBuffer.erase(m_DrawList->CmdBuffer.Data + m_DrawListCommadBufferSize - 1);

//DEBUG: Search the *entire* draw list for the sentinel command
for(int i=0; i<m_DrawList->CmdBuffer.size(); i++)
{
if(m_DrawList->CmdBuffer[i].UserCallback == ImDrawCallback_ImCanvas)
{
/*fprintf(stderr, "found and removed sentinel at offset %d, expected %d or %d\n",
i,
m_DrawListCommadBufferSize,
m_DrawListCommadBufferSize-1);*/

m_DrawList->CmdBuffer.erase(m_DrawList->CmdBuffer.Data + i);
}
}
}

auto& fringeScale = ImFringeScaleRef(m_DrawList);
Expand Down

0 comments on commit 6b7fe16

Please sign in to comment.