-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Viewports support crash with multiple instances of Dear Imgui Apps #8162
Comments
Ouch. I didn’t realize GetProp() was not process bound. |
I can confirm that this simple change fixes the problem. Adding at the beginning of imgui_impl_win32.cpp
Then add this code to ImGui_ImplWin32_InitEx()
And finally replace all GetPropA/SetPropA to using the 2 global variables as keys. I can create a pull request sometime this week if you would like. |
This was caused by fedf45c (#8069) Fix was a little bit trickier than suggested: we can't easily the same technique for IMGUI_CONTEXT.
For IMGUI_VIEWPORT i stopped using As expected #8069 is quite causing trouble but happy to experiment with those aspects in a backend. |
Fixed by dad1047 |
Version/Branch of Dear ImGui:
Version 1.91.5 Branch: docking
Back-ends:
imgui_impl_dx11, imgui_impl_win32
Compiler, OS:
MSVC 2022
Full config/build information:
Details:
My Issue/Question:
It seems that the current implementation of using SetPropA/GetPropA to store some pointers (IMGUI_CONTEXT, IMGUI_VIEWPORT) on win32 and glfw, doesn't take into account that there can be more than 1 Dear ImGui applications running. This cause read access violation when a process tries reading memory belonging to the 2nd process.
I believe that we should either use a unique string per process when using GetPropA/SetPropA or validate that the windows returned by '::WindowFromPoint' belongs to the process.
Screenshots/Video:
Minimal, Complete and Verifiable Example code:
Compile one of the win32 sample, launch it from visual studio, then launch the same exe from the file system. Notice that having your mouse hovering the 2nd launched application will cause a crash in the non hovered app.
The text was updated successfully, but these errors were encountered: