-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
ImGuiListClipper behaviour with garbage collected instance (when not calling End) #4822
Comments
This does not happen with main.cpp modified for having ImGuiListClipper. local igwin = require"imgui.window"
local win = igwin:SDL(800,400, "list clipper")
function win:draw(ig)
local cols = 10
if ig.Begin("testt") then
local clipper = ig.ImGuiListClipper()
clipper:Begin(1000)
while (clipper:Step()) do
for line = clipper.DisplayStart,clipper.DisplayEnd-1 do
for N=line*cols+1,line*cols+cols do
if ig.Button(string.format("%d",N)) then
print(N)
end
if not ((N)%cols == 0) then ig.SameLine() end
end
end
end
end
ig.End()
collectgarbage()
end
win:start() But if collectgarbage is not used (it calls __gc on clipper) so that there are several ImGuiListClipper creations before destroy is called the problem reappears. |
What happen if you simply call |
|
correction: with |
I will try to rework things to have the final step automatically do the End() before waiting for the destructor. I recall there was an issue preventing to do this easily but i’ll work it out.
|
Having to call clipper.End at the end of Step loop seems to me a clearer pattern for the casual ImGui user |
Yes but technically we have a regression now, and Rust users are also affected. I'll look into it now. |
Pushed a fix now d9e60d2 Thanks for reporting! |
Version: 1.86
Branch:docking
with LuaJIT-ImGui
running this program
I am getting this assertion:
I dont know if it is due to bug or misuse (Althought it used to work before)
The text was updated successfully, but these errors were encountered: