-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
TableGetSortSpecs can return structure with corrupt ImGuiTableSortSpecs::Specs
#4233
Labels
Comments
Thank you for the report! Looks like this was broken by 4ce6bd8 (May 7) |
I can confirm the bug however note that it would only affect the case of not checking the |
Willy-JL
added a commit
to Willy-JL/F95Checker
that referenced
this issue
Dec 20, 2024
ocornut/imgui#4233 bug in imgui, sorts can return corrupted data when specs_dirty is false fixed in imgui 1.84, pyimgui is imgui 1.82 here we were always checking sort specs as different tabs can have different table ids, but switching them dont count as specs_dirty thus alway checking the actual specs allowed to sort again when changing tabs now instead we save the specs all such tables when its specs_dirty is true means no checking specs without specs_dirty, avoiding the imgui bug but can still use correct sorting when changing tab as we save different sorts for different table ids thanks FaceCrap for finding that imgui issue thread!
disaster2395
pushed a commit
to disaster2395/F95Checker
that referenced
this issue
Dec 21, 2024
ocornut/imgui#4233 bug in imgui, sorts can return corrupted data when specs_dirty is false fixed in imgui 1.84, pyimgui is imgui 1.82 here we were always checking sort specs as different tabs can have different table ids, but switching them dont count as specs_dirty thus alway checking the actual specs allowed to sort again when changing tabs now instead we save the specs all such tables when its specs_dirty is true means no checking specs without specs_dirty, avoiding the imgui bug but can still use correct sorting when changing tab as we save different sorts for different table ids thanks FaceCrap for finding that imgui issue thread!
disaster2395
pushed a commit
to disaster2395/F95Checker
that referenced
this issue
Dec 21, 2024
ocornut/imgui#4233 bug in imgui, sorts can return corrupted data when specs_dirty is false fixed in imgui 1.84, pyimgui is imgui 1.82 here we were always checking sort specs as different tabs can have different table ids, but switching them dont count as specs_dirty thus alway checking the actual specs allowed to sort again when changing tabs now instead we save the specs all such tables when its specs_dirty is true means no checking specs without specs_dirty, avoiding the imgui bug but can still use correct sorting when changing tab as we save different sorts for different table ids thanks FaceCrap for finding that imgui issue thread!
Willy-JL
added a commit
to Willy-JL/F95Checker
that referenced
this issue
Dec 23, 2024
ocornut/imgui#4233 bug in imgui, sorts can return corrupted data when specs_dirty is false fixed in imgui 1.84, pyimgui is imgui 1.82 here we were always checking sort specs as different tabs can have different table ids, but switching them dont count as specs_dirty thus always checking the actual specs allowed to sort again when changing tabs now instead we save the specs of all such tables when its specs_dirty is true means no checking specs without specs_dirty, avoiding the imgui bug but can still use correct sorting when changing tab as we save different sorts for different table ids thanks FaceCrap for finding that imgui issue thread!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version/Branch of Dear ImGui:
Version: 1.84 WIP (18303)
Branch: master (commit d5828cd)
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp
Compiler: clang 10
Operating System: linux (ubuntu)
My Issue/Question:
TableGetSortSpecs
can return structure with a corruptImGuiTableSortSpecs::Specs
if table sort order hasn't been dirtied.The contents of the array referenced by
ImGuiTableSortSpecs::Specs
might also be well formed (but invalid for the table) or point to pure junk.This matters if you want to know the sort spec for a table even if the spec hasn't changed.
e.g. Your backing store occasionally invalidates and you need to reapply sorting.
Cause is described below. In this context an 'ephemeral' alloc is a mem alloc that is only valid for the duration of a
BeginTableEx
/EndTable
span.Header/docs states the following invariants for
TableGetSortSpecs
:Docs for
ImGuiTableSortSpecs
don't impose any additional invariants.Screenshots/Video
N/A. Not a layout/visual issue.
Example
This demo draws a full-display window containing two sortable tables.
Click on column header
B
to change the sorting spec of the first table. This will trigger an assertion when drawing the second table, demonstrating that its sort spec has been (visibly) corrupted.This sample could trigger an immediate crash if
Specs
were allocated using a mechanism that doesn't reuse previous allocations.On my system/run the
Specs
member points to the same address for both tables. (Legal, but impl doesn't update the array for the second table.)Source Code:
Full about dump:
The text was updated successfully, but these errors were encountered: