mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-23 16:16:36 +00:00
Viewport: Fixed a situation when the implicit Debug window can hold on a zombie viewport which platform window is not properly destroyed. (#1542)
This commit is contained in:
parent
23b67e6ff5
commit
74077491ce
20
imgui.cpp
20
imgui.cpp
@ -3955,29 +3955,29 @@ void ImGui::UpdatePlatformWindows()
|
||||
{
|
||||
ImGuiViewportP* viewport = g.Viewports[i];
|
||||
viewport->LastPos = viewport->Pos;
|
||||
if (viewport->LastFrameActive < g.FrameCount)
|
||||
|
||||
// Destroy platform window if the viewport hasn't been submitted or if it is hosting a hidden window (the implicit Debug window will be registered its viewport then be disabled)
|
||||
bool destroy_platform_window = false;
|
||||
destroy_platform_window |= (viewport->LastFrameActive < g.FrameCount - 1);
|
||||
destroy_platform_window |= (viewport->Window && !IsWindowActiveAndVisible(viewport->Window));
|
||||
if (destroy_platform_window)
|
||||
{
|
||||
if (viewport->LastFrameActive < g.FrameCount - 1)
|
||||
{
|
||||
if (g.PlatformIO.Renderer_DestroyWindow)
|
||||
if (viewport->CreatedPlatformWindow && g.PlatformIO.Renderer_DestroyWindow)
|
||||
g.PlatformIO.Renderer_DestroyWindow(viewport);
|
||||
if (g.PlatformIO.Platform_DestroyWindow)
|
||||
if (viewport->CreatedPlatformWindow && g.PlatformIO.Platform_DestroyWindow)
|
||||
g.PlatformIO.Platform_DestroyWindow(viewport);
|
||||
viewport->CreatedPlatformWindow = false;
|
||||
IM_ASSERT(viewport->RendererUserData == NULL);
|
||||
IM_ASSERT(viewport->PlatformUserData == NULL && viewport->PlatformHandle == NULL);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (viewport->LastFrameActive < g.FrameCount)
|
||||
continue;
|
||||
|
||||
// New windows that appears directly in a new viewport won't always have a size on their frame
|
||||
if (viewport->Size.x <= 0 || viewport->Size.y <= 0)
|
||||
continue;
|
||||
|
||||
// Ignore viewport that are hosting a hidden window (also check the Active flag, as the implicit Debug window will be registering its viewport then immediately disabled)
|
||||
if (viewport->Window && !IsWindowActiveAndVisible(viewport->Window))
|
||||
continue;
|
||||
|
||||
// Update viewport flags
|
||||
if (viewport->Window != NULL)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user