diff --git a/src/modules/fancyzones/lib/ZoneSet.cpp b/src/modules/fancyzones/lib/ZoneSet.cpp index 30489d596ff5..6b4b90ec597b 100644 --- a/src/modules/fancyzones/lib/ZoneSet.cpp +++ b/src/modules/fancyzones/lib/ZoneSet.cpp @@ -49,7 +49,7 @@ IFACEMETHODIMP_(winrt::com_ptr) ZoneSet::ZoneFromPoint(POINT pt) noexcept winrt::com_ptr smallestKnownZone = nullptr; // To reduce redundant calculations, we will store the last known zones area. int smallestKnownZoneArea = INT32_MAX; - for (auto iter = m_zones.begin(); iter != m_zones.end(); iter++) + for (auto iter = m_zones.rbegin(); iter != m_zones.rend(); iter++) { if (winrt::com_ptr zone = iter->try_as()) { diff --git a/src/modules/fancyzones/lib/ZoneWindow.cpp b/src/modules/fancyzones/lib/ZoneWindow.cpp index dc354e5d2c08..7bf747c76485 100644 --- a/src/modules/fancyzones/lib/ZoneWindow.cpp +++ b/src/modules/fancyzones/lib/ZoneWindow.cpp @@ -553,7 +553,7 @@ void ZoneWindow::DrawActiveZoneSet(wil::unique_hdc& hdc, RECT const& clientRect) auto zones = m_activeZoneSet->GetZones(); const size_t maxColorIndex = min(size(zones) - 1, size(colors) - 1); size_t colorIndex = maxColorIndex; - for (auto iter = zones.rbegin(); iter != zones.rend(); iter++) + for (auto iter = zones.begin(); iter != zones.end(); iter++) { winrt::com_ptr zone = iter->try_as(); if (!zone)