From 209a4a3ddf4618f0255b0120cb620bb8b89c3cbe Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 29 Jan 2014 19:15:50 +0000 Subject: [PATCH] ClientManager: use lifo behaviour for free windows --- src/client_manager.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client_manager.cc b/src/client_manager.cc index 5c5ad902..91cc6406 100644 --- a/src/client_manager.cc +++ b/src/client_manager.cc @@ -83,7 +83,7 @@ void ClientManager::remove_client(Client& client) WindowAndSelections ClientManager::get_free_window(Buffer& buffer) { - for (auto it = m_free_windows.begin(), end = m_free_windows.end(); + for (auto it = m_free_windows.rbegin(), end = m_free_windows.rend(); it != end; ++it) { auto& w = it->window; @@ -91,7 +91,7 @@ WindowAndSelections ClientManager::get_free_window(Buffer& buffer) { w->forget_timestamp(); WindowAndSelections res = std::move(*it); - m_free_windows.erase(it); + m_free_windows.erase(it.base()-1); return res; } }