Skip to content
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

Why does the ImGuiListClipper save it's own ImGuiContext? #7737

Closed
Explowox opened this issue Jun 25, 2024 · 2 comments
Closed

Why does the ImGuiListClipper save it's own ImGuiContext? #7737

Explowox opened this issue Jun 25, 2024 · 2 comments

Comments

@Explowox
Copy link

Version/Branch of Dear ImGui:

Version 1.90, Branch: master

Back-ends:

imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

Windows 11 + VS2022

Full config/build information:

No response

Details:

My Question:

I'm currently using the ImGuiFileDialog, where one of the possible ways to create a FileDialog is through access of a Singleton that (among other things) holds an instance of an ImGuiListClipper. However, the ImGuiListClipper instance holds it's own ImGuiContext which is (as far as I can tell) only set once to the current context in the Begin() method and never updated again during the lifetime of the clipper. My project unfortunately switches between multiple ImGuiContexts which invalidates the internal clipper context.

This made me wonder why doesn't the ImGuiListClipper refer to the global GImGui context?

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

@ocornut
Copy link
Owner

ocornut commented Jun 25, 2024

It was added to facilitate the transition toward #5856
A clipper may be reused again with another context, no issue with that.

@ocornut
Copy link
Owner

ocornut commented Jun 26, 2024

For now please clear it with clipper->Ctx = NULL.
I envision that we will rework this API at some point anyhow, making imgui owns the instance so it won't be a problem.
Let me know if you have other questions!

@ocornut ocornut closed this as completed Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants