[UI] Fix frame leak on context loss.

This commit is contained in:
Joel Linn 2019-12-01 22:03:24 +01:00 committed by Rick Gibbed
parent 2c99228041
commit f0723c211b
1 changed files with 2 additions and 1 deletions

View File

@ -199,7 +199,6 @@ void Window::OnPaint(UIEvent* e) {
} }
io.DisplaySize = ImVec2(static_cast<float>(scaled_width()), io.DisplaySize = ImVec2(static_cast<float>(scaled_width()),
static_cast<float>(scaled_height())); static_cast<float>(scaled_height()));
ImGui::NewFrame();
context_->BeginSwap(); context_->BeginSwap();
if (context_->WasLost()) { if (context_->WasLost()) {
@ -207,6 +206,8 @@ void Window::OnPaint(UIEvent* e) {
return; return;
} }
ImGui::NewFrame();
ForEachListener([e](auto listener) { listener->OnPainting(e); }); ForEachListener([e](auto listener) { listener->OnPainting(e); });
on_painting(e); on_painting(e);
ForEachListener([e](auto listener) { listener->OnPaint(e); }); ForEachListener([e](auto listener) { listener->OnPaint(e); });