mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Better error reporting for PopStyleColor()/PopStyleVar() + easier to recover. (#1651)
This commit is contained in:
parent
747c9a7adf
commit
7f25143972
@ -83,6 +83,7 @@ Other Changes:
|
|||||||
- Nav: Pressing Space/GamepadFaceDown on a repeating button uses the same repeating rate as a mouse hold.
|
- Nav: Pressing Space/GamepadFaceDown on a repeating button uses the same repeating rate as a mouse hold.
|
||||||
- Platform IME: [Windows] Removed call to ImmAssociateContextEx() leading to freeze on some setups.
|
- Platform IME: [Windows] Removed call to ImmAssociateContextEx() leading to freeze on some setups.
|
||||||
(#2589, #5535, #5264, #4972)
|
(#2589, #5535, #5264, #4972)
|
||||||
|
- Misc: better error reporting for PopStyleColor()/PopStyleVar() + easier to recover. (#1651)
|
||||||
- Misc: io.Framerate moving average now converge in 60 frames instead of 120. (#5236, #4138)
|
- Misc: io.Framerate moving average now converge in 60 frames instead of 120. (#5236, #4138)
|
||||||
- Debug Tools: Debug Log: Added 'IO' and 'Clipper' events logging.
|
- Debug Tools: Debug Log: Added 'IO' and 'Clipper' events logging.
|
||||||
- Debug Tools: Item Picker: Mouse button can be changed by holding Ctrl+Shift, making it easier
|
- Debug Tools: Item Picker: Mouse button can be changed by holding Ctrl+Shift, making it easier
|
||||||
|
10
imgui.cpp
10
imgui.cpp
@ -2860,6 +2860,11 @@ void ImGui::PushStyleColor(ImGuiCol idx, const ImVec4& col)
|
|||||||
void ImGui::PopStyleColor(int count)
|
void ImGui::PopStyleColor(int count)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
if (g.ColorStack.Size < count)
|
||||||
|
{
|
||||||
|
IM_ASSERT_USER_ERROR(g.ColorStack.Size > count, "Calling PopStyleColor() too many times: stack underflow.");
|
||||||
|
count = g.ColorStack.Size;
|
||||||
|
}
|
||||||
while (count > 0)
|
while (count > 0)
|
||||||
{
|
{
|
||||||
ImGuiColorMod& backup = g.ColorStack.back();
|
ImGuiColorMod& backup = g.ColorStack.back();
|
||||||
@ -2944,6 +2949,11 @@ void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val)
|
|||||||
void ImGui::PopStyleVar(int count)
|
void ImGui::PopStyleVar(int count)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
if (g.StyleVarStack.Size < count)
|
||||||
|
{
|
||||||
|
IM_ASSERT_USER_ERROR(g.StyleVarStack.Size > count, "Calling PopStyleVar() too many times: stack underflow.");
|
||||||
|
count = g.StyleVarStack.Size;
|
||||||
|
}
|
||||||
while (count > 0)
|
while (count > 0)
|
||||||
{
|
{
|
||||||
// We avoid a generic memcpy(data, &backup.Backup.., GDataTypeSize[info->Type] * info->Count), the overhead in Debug is not worth it.
|
// We avoid a generic memcpy(data, &backup.Backup.., GDataTypeSize[info->Type] * info->Count), the overhead in Debug is not worth it.
|
||||||
|
Loading…
Reference in New Issue
Block a user