From ae839fc4713dafd887f0f872191924742a3c8832 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 23 Aug 2015 13:29:24 +0100 Subject: [PATCH] Remove Client::window() method, use a force_redraw() one We cannot assume Client::m_window is always non-null, as when changing current buffer its temporarily null, at the point where WinCreate hook might get called. Fixes #382 --- src/client.cc | 6 ++++++ src/client.hh | 2 +- src/commands.cc | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/client.cc b/src/client.cc index df145178..2e371e0f 100644 --- a/src/client.cc +++ b/src/client.cc @@ -166,6 +166,12 @@ void Client::redraw_ifn() ui.refresh(); } +void Client::force_redraw() +{ + if (m_window) + m_window->force_redraw(); +} + void Client::reload_buffer() { auto& buffer = context().buffer(); diff --git a/src/client.hh b/src/client.hh index 8a8c309f..70c8f706 100644 --- a/src/client.hh +++ b/src/client.hh @@ -35,10 +35,10 @@ public: void print_status(DisplayLine status_line); + void force_redraw(); void redraw_ifn(); UserInterface& ui() const { return *m_ui; } - Window& window() const { return *m_window; } void check_if_buffer_needs_reloading(); diff --git a/src/commands.cc b/src/commands.cc index 0d7c1017..d1cb9b46 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1536,7 +1536,7 @@ const CommandDesc face_cmd = { FaceRegistry::instance().register_alias(parser[0], parser[1], true); for (auto& client : ClientManager::instance()) - client->window().force_redraw(); + client->force_redraw(); } };