Windows closed while we're displaying them might lead to invalid
memory accessed, so use the safe iterators on the list of windows.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4430>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4430>
window->destroy(window);
}
- list_for_each_entry(struct window, window, &context.windows, link) {
+ list_for_each_entry_safe(struct window, window, &context.windows, link) {
ImGui::SetNextWindowPos(window->position, ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(window->size, ImGuiCond_FirstUseEver);
if (ImGui::Begin(window->name, &window->opened)) {