diff --git a/src/prism.cpp b/src/prism.cpp index 5afe26b..72b60a4 100644 --- a/src/prism.cpp +++ b/src/prism.cpp @@ -42,7 +42,8 @@ void Application::run() cullClosedWindowsExitOnMainDeath(); // Render the windows - for (auto& window : appWindows) + std::vector> appWindowsCopy = appWindows; // Quick fix for windows closing/opening during render, revisit later + for (auto& window : appWindowsCopy) window->render(); } } diff --git a/src/window.cpp b/src/window.cpp index bf2441e..dcadafc 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -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);