From 5abd2a7ceffadf4ebf18895ab5f1c2c1b1053f6d Mon Sep 17 00:00:00 2001 From: Bruno Van de Velde Date: Wed, 17 Jul 2024 20:11:47 +0200 Subject: [PATCH] Theme::replace could enter an infinite loop since commit c68749b (5 days ago) --- changelog.md | 1 + src/Loading/Theme.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 40d53b6c9..903f4a821 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ TGUI 1.4.1 (TBD) ----------------- +- Fixed infinite loop in Theme::replace (introduced in TGUI 1.4.0) - PanelListBox now has proper background color and borders in White theme diff --git a/src/Loading/Theme.cpp b/src/Loading/Theme.cpp index c4f0ed620..91ae58515 100644 --- a/src/Loading/Theme.cpp +++ b/src/Loading/Theme.cpp @@ -721,7 +721,10 @@ namespace tgui for (auto pair : m_renderers) { const auto& renderer = pair.second; - for (auto& observer : renderer->observers) + + // Make a copy of the observers because setRenderer alters the observers + auto observers = renderer->observers; + for (auto* observer : observers) observer->setRenderer(renderer); }