From 7905382b747ef77515183b15812000122dc5503f Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 25 Jul 2018 21:23:22 +1000 Subject: [PATCH] Obtain a new window for a client before releasing the current one Creating a window potentially runs hooks, which themselves could trigger shell evaluation, which could handle urgent input events such as a resize, while waiting for the shell to finish. When that happens, the client had a temporarily null window as it had already released its own window. Fixes #2225 --- src/client.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client.cc b/src/client.cc index 7baf551b..44702331 100644 --- a/src/client.cc +++ b/src/client.cc @@ -175,10 +175,10 @@ void Client::change_buffer(Buffer& buffer) auto& client_manager = ClientManager::instance(); m_window->options().unregister_watcher(*this); m_window->set_client(nullptr); + + WindowAndSelections ws = client_manager.get_free_window(buffer); client_manager.add_free_window(std::move(m_window), std::move(context().selections())); - WindowAndSelections ws = client_manager.get_free_window(buffer); - m_window = std::move(ws.window); m_window->set_client(this); m_window->options().register_watcher(*this);