Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

dbr
Copy link
Contributor

@dbr dbr commented Mar 18, 2022

Closes #610

Adds a hard-to-misuse iterator wrapper around the list clipper interface. Retains the step/display_start/display_end API for consistency with C++ and it is slightly more flexible which might be important in a few circumstances (where you want to draw the entire start..end chunk in a single call)

Main part missing currently is I haven't backported the upstream bugfix preventing "clipper.end(); clipper.step()` from segfaulting because of a null pointer (with the changes mentioned in #610 it will crash via assert() instead)

However this now only crashes if the user calls end and step explicitly - previously it was crashing if user just called .end() (because the drop token was incorrectly calling step()) - sort of undecided if it's worth backporting the change given this is a lesser used feature, and it's in an error path. Might be better to add a temporary internal check for double-end and panic - we can them remove it in future imgui release

dbr added 2 commits March 18, 2022 22:07
1. Avoid calling step() in destructor - incorrect and unnecessary, as it is not required to fully "use" the clipper (you can stop rendering half-way through)
2. Add a harder to misuse iterator interface to the clipper as an alterantive to the C++ style .step() interface

Closes imgui-rs#610
@dbr dbr added this to the v0.9 milestone Mar 18, 2022
@dbr dbr merged commit 12a1238 into imgui-rs:main Mar 22, 2022
@dbr dbr deleted the clipperfix branch March 22, 2022 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rework/simplify ListClipper drop impl
1 participant