diff --git a/external/imgui-backend-qt b/external/imgui-backend-qt index a914f181..9bddcf9a 160000 --- a/external/imgui-backend-qt +++ b/external/imgui-backend-qt @@ -1 +1 @@ -Subproject commit a914f1811185f5959d50f2a199420dee4d15ae74 +Subproject commit 9bddcf9a1a6ca63f71a953fc060d81545f36918a diff --git a/scwx-qt/source/scwx/qt/model/imgui_context_model.cpp b/scwx-qt/source/scwx/qt/model/imgui_context_model.cpp index 7dd30433..d90c96dc 100644 --- a/scwx-qt/source/scwx/qt/model/imgui_context_model.cpp +++ b/scwx-qt/source/scwx/qt/model/imgui_context_model.cpp @@ -117,16 +117,17 @@ void ImGuiContextModel::DestroyContext(const std::string& name) if (it != p->contexts_.end()) { - const int position = it - p->contexts_.begin(); - - // Destroy context - ImGui::SetCurrentContext(it->context_); - ImGui::DestroyContext(); + const int position = it - p->contexts_.begin(); + ImGuiContext* context = it->context_; // Erase context from index beginRemoveRows(QModelIndex(), position, position); p->contexts_.erase(it); endRemoveRows(); + + // Destroy context + ImGui::SetCurrentContext(context); + ImGui::DestroyContext(); } }