Skip to content

Commit

Permalink
fix for window spawning or closing another
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Pelham committed Sep 15, 2024
1 parent 50c265d commit 6d455c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/prism.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ void Application::run()
cullClosedWindowsExitOnMainDeath();

// Render the windows
for (auto& window : appWindows)
std::vector<std::shared_ptr<Window>> appWindowsCopy = appWindows; // Quick fix for windows closing/opening during render, revisit later
for (auto& window : appWindowsCopy)
window->render();
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ Window::~Window()

void Window::render()
{
// Check context is valid before rendering
if (!imguiContext)
return;

// Swap contexts
ImGuiContext* backupContext = ImGui::GetCurrentContext();
ImGui::SetCurrentContext(imguiContext);
Expand Down

0 comments on commit 6d455c9

Please sign in to comment.