Fix ImGui context destruction order

This commit is contained in:
Dan Paulat 2022-11-28 10:07:52 -06:00
parent 399a07b1e2
commit 7ec12821b9
2 changed files with 7 additions and 6 deletions

@ -1 +1 @@
Subproject commit a914f1811185f5959d50f2a199420dee4d15ae74 Subproject commit 9bddcf9a1a6ca63f71a953fc060d81545f36918a

View file

@ -118,15 +118,16 @@ void ImGuiContextModel::DestroyContext(const std::string& name)
if (it != p->contexts_.end()) if (it != p->contexts_.end())
{ {
const int position = it - p->contexts_.begin(); const int position = it - p->contexts_.begin();
ImGuiContext* context = it->context_;
// Destroy context
ImGui::SetCurrentContext(it->context_);
ImGui::DestroyContext();
// Erase context from index // Erase context from index
beginRemoveRows(QModelIndex(), position, position); beginRemoveRows(QModelIndex(), position, position);
p->contexts_.erase(it); p->contexts_.erase(it);
endRemoveRows(); endRemoveRows();
// Destroy context
ImGui::SetCurrentContext(context);
ImGui::DestroyContext();
} }
} }